Bubblesoft Mathematical Library V2.1: Subroutine List

The following is a list of the name and purpose of each function and subroutine in the library. It includes a few intended primarily for internal library use, such as the single Runge -- Kutta steps.

Administrative

bm_version : print version number

Complex numbers

Linear systems

bmc_matdetg : matrix determinant (Givens rotations)
bmc_matdetlu : matrix determinant (LU decomposition)
bmc_matinvg : matrix inverse (Givens rotations)
bmc_matinvlu : matrix inverse (LU decomposition)
bmc_matludecomp : matrix LU decomposition
bmc_matlumsubst : LU back-substitution (multiple vectors)
bmc_matlusubst : LU back-substitution
bmc_matsolcg : solution of matrix equation (conjugate gradients)
bmc_matsolg : solution of matrix equation (Givens rotations)
bmc_matsollu : solution of matrix equation (LU decomposition)
bmc_muptrisol : solution of upper triangular matrix equation (multiple vectors)
bmc_orthoggs : Gram-Schmidt orthogonalisation
bmc_sparsematsolcg : solution of sparse matrix equation (conjugate gradients)
bmc_tridiagludecomp : LU decomposition of tridiagonal matrix equation
bmc_tridiaglusubst : LU back-substitution of tridiagonal matrix equation
bmc_tridiagsollu : solution of tridiagonal matrix equation
bmc_uptrisol : solution of upper triangular matrix equation
bmc_vanmonfitsol : solution of Vandermonde matrix equation (fitting type)
bmc_vanmonmomsol : solution of Vandermonde matrix equation (moments type)

Matrix utilities

bmc_mattotel : sum of elements
bmc_mattrace : trace of matrix
bmc_matabstotel : sum of absolute values of elements
bmc_matnorm : norm of matrix
bmc_matabsbigel : find element of largest magnitude
bmc_matabstinel : find element of smallest magnitude
bmc_matadd : add matrices
bmc_mateq : set matrices equal
bmc_matfilter : set small values to zero
bmc_matidentity : create identity matrix
bmc_matmult : multiply matrices
bmc_matmulttran : multiply matrix by transpose of matrix
bmc_matmultvec : multiply vector by matrix
bmc_matread : simple read of matrix elements
bmc_matset : set matrix elements to a single value
bmc_matshow : display matrix
bmc_matsmult : multiply matrix by scalar
bmc_matsub : subtract matrices
bmc_mattran : transpose matrix
bmc_mattranmult : multiply matrix by transpose of matrix
bmc_mattranmultvec : multiply vector by transpose of matrix
bmc_matstackhoriz : combine two matrices by `stacking side-by-side'
bmc_matstackvert : combine two matrices by `stacking vertically'

Vectors

bmc_veccross2D : cross product (2D)
bmc_vecdot : inner product
bmc_vecdot2D : inner product (2D)
bmc_vecdot3D : inner product (3D)
bmc_vectotel : sum of elements
bmc_vecabstotel : sum of absolute values of elements
bmc_veclen : length
bmc_veclen2D : length (2D)
bmc_veclen3D : length (3D)
bmc_vecnorm : norm
bmc_vecnorm2D : norm (2D)
bmc_vecnorm3D : norm (3D)
bmc_vecabsbigel : find largest absolute element
bmc_vecabstinel : find smallest absolute element
bmc_vecadd : add vectors
bmc_vecadd2D : add vectors (2D)
bmc_vecadd3D : add vectors (3D)
bmc_veccross3D : cross product (3D)
bmc_vecdirprod : outer product
bmc_veceq : set vectors equal
bmc_veceq2D : set vectors equal (2D)
bmc_veceq3D : set vectors equal (3D)
bmc_vecfilter : set small elements to zero
bmc_vecnormalise : normalise vector
bmc_vecnormalise2D : normalise vector (2D)
bmc_vecnormalise3D : normalise vector (3D)
bmc_vecread : read elements
bmc_vecread2D : read elements (2D)
bmc_vecread3D : read elements (3D)
bmc_vecset : set elements to a single value
bmc_vecset2D : set elements to a single value (2D)
bmc_vecset3D : set elements to a single value (3D)
bmc_vecshow : display vector
bmc_vecshow2D : display vector (2D)
bmc_vecshow3D : display vector (3D)
bmc_vecsmult : multiply vector by scalar
bmc_vecsmult2D : multiply vector by scalar (2D)
bmc_vecsmult3D : multiply vector by scalar (3D)
bmc_vecsub : subtract vectors
bmc_vecsub2D : subtract vectors (2D)
bmc_vecsub3D : subtract vectors (3D)
bmc_wedge1 : wedge product

Real numbers

Mathematical and physical constants

bm_Ggrav : gravitational constant
bm_Qcharge : charge on electron
bm_amu : atomic mass units
bm_avogadro : Avogadro's number
bm_clight : speed of light
bm_e : exp(1)
bm_elecmass : mass of electron
bm_epsilon0 : permittivity of free space
bm_eulmasch : Euler-Mascheroni constant
bm_hPlanck : Planck's constant
bm_kBoltzmann : Boltzmann's constant
bm_mu0 : permeability of free space
bm_pi : pi
bm_sigmaStefBoltz : Stefan-Boltzmann constant

Coordinate system conversions

bm_deg2rad : degrees to radians
bm_rad2deg : radians to degrees
bm_rt2xy : 2D polar to Cartesian
bm_rtp2xyz : 3D spherical to Cartesian
bm_xy2rt : 2D Cartesian to polar
bm_xyz2rtp : 3D Cartesian to spherical

Data fitting

bm_gncfit : Gauss-Newton with second derivatives
bm_gncfitmem : Gauss-Newton with second derivatives (stores Jacobian)
bm_gnfit : Gauss-Newton
bm_gnfitmem : Gauss-Newton (stores Jacobian)
bm_linfit : general linear functions
bm_lmfit : Levenberg-Mardquart
bm_lmfitmem : Levenberg-Mardquart (stores Jacobian)
bm_lsqline : linear least squares
bm_polyfitg : polynomial (Givens rotations)
bm_polyfitn : polynomial (normal equation)

Eigensystems

bm_evechesshqr : solve in Hessenberg form
bm_evechqr : solve
bm_evecsymmhql : solve symmetric
bm_evecsymmtridiagql : solve symmetric tridiagonal
bm_genhessh : convert general matrix to Hessenberg form
bm_matqlh : QL decomposition
bm_matqrh : QR decomposition
bm_symmtridiagh : convert symmetric to tridiagonal

Expression evaluation

bm_charval : convert character expression to numerical value
bm_parse : parse an expression into a series of operations
bm_operate : perform a series of operations on an array of numbers

Finite difference operations (single cell)

These follow a simple naming convention:

Operation

Type of cell

bm_average1D
bm_averagearbcell2D
bm_averagearbcell3D
bm_averagearbcellND
bm_averagecub3D
bm_averagerec2D
bm_convectarbcell2D
bm_convectarbcell3D
bm_convectarbcellND
bm_curlarbcell2D
bm_curlarbcell3D
bm_curlcub3D
bm_curlrec2D
bm_div1D
bm_divarbcell2D
bm_divarbcell3D
bm_divarbcellND
bm_divcub3D
bm_divrec2D
bm_grad1D
bm_gradarbcell2D
bm_gradarbcell3D
bm_gradarbcellND
bm_gradcub3D
bm_gradrec2D
bm_integral1D
bm_integralcub3D
bm_integralrec2D
bm_laplac1D
bm_laplaccub3D
bm_laplacrec2D
bm_volume1D
bm_volumecub3D
bm_volumerec2D

Finite difference operations on a field

These follow a simple naming convention:

Operation

Location of data

Type of cell

bm_averagearb2D
bm_averagearb3D
bm_averagearbND
bm_averagecen1D
bm_averagecencub3D
bm_averagecenrec2D
bm_averagenode1D
bm_averagenodecub3D
bm_averagenoderec2D
bm_convectarb2D
bm_convectarb3D
bm_convectarbND
bm_curlarb2D
bm_curlarb3D
bm_curlcencub3D
bm_curlcenrec2D
bm_curlnodecub3D
bm_curlnoderec2D
bm_divarb2D
bm_divarb3D
bm_divarbND
bm_divcen1D
bm_divcencub3D
bm_divcenrec2D
bm_divnode1D
bm_divnodecub3D
bm_divnoderec2D
bm_gradarb2D
bm_gradarb3D
bm_gradarbND
bm_gradcen1D
bm_gradcencub3D
bm_gradcenrec2D
bm_gradnode1D
bm_gradnodecub3D
bm_gradnoderec2D
bm_integralcen1D
bm_integralcencub3D
bm_integralcenrec2D
bm_integralnode1D
bm_integralnodecub3D
bm_integralnoderec2D
bm_laplaccen1D
bm_laplaccencub3D
bm_laplaccenrec2D
bm_laplacnode1D
bm_laplacnodecub3D
bm_laplacnoderec2D
bm_volumecen1D
bm_volumecencub3D
bm_volumecenrec2D
bm_volumenode1D
bm_volumenodecub3D
bm_volumenoderec2D

Useful functions

bm_alegpoly : associated Legendre polynomial
bm_bessj0 : Bessel J0 function
bm_bessj1 : Bessel J1 function
bm_bessy0 : Bessel Y0 function
bm_bessy1 : Bessel Y1 function
bm_beta : beta function
bm_binco : binomial coefficient
bm_ellipe : elliptic E function
bm_ellipk : elliptic K function
bm_erfapprox : error function (approximation)
bm_erfcapprox : complementary error function (approximation)
bm_factorial : factorial
bm_fresnelc : Fresnel C function
bm_fresnels : Fresnel S function
bm_gamma : gamma function
bm_lnfactorial : ln of factorial
bm_lngamma : ln of gamma function
bm_polynom : polynomial
bm_bessel : Bessel function
bm_bezier : Bezier function
bm_bezier2D : Bezier curve (2D)
bm_bezier3D : Bezier curve (3D)
bm_beziersurf : Bezier hyper surface
bm_erf : error function
bm_erfc : complementary error function
bm_spherharm : spherical harmonics

Geometry

bm_angsub2D : angle subtended (2D)
bm_angsub3D : solid angle subtended (3D)
bm_lineconeint : intersection between line and (hyper)cone
bm_linecylint : intersection between line and (hyper)cylinder
bm_linedist : distance between lines
bm_linedist3D : distance between lines (3D)
bm_lineellipsoidint : intersection between line and (hyper)ellipsoid
bm_linegenconeint : intersection between line and general (hyper)cone
bm_linegenellipsoidint : intersection between line and general (hyper)ellipsoid
bm_lineint : intersection between lines
bm_lineint2D : intersection between lines (2D)
bm_lineint3D : intersection between lines (3D)
bm_lineplaneint : intersection between line and (hyper)plane
bm_lineplaneint3D : intersection between line and plane (3D)
bm_linesphereint : intersection between line and (hyper)sphere
bm_rotate2D : rotate a vector (2D)
bm_rotate3D : rotate a vector (3D)
bm_comtgtquad : common tangent of quadratic curves

Integration

bm_rombint : Romberg
bm_simpint : Simpson's rule
bm_trapint : trapezoidal

Interpolation and extrapolation

bm_interplin : linear
bm_interppoly : polynomial
bm_interpspline : spline
bm_setinterpspline : calculate coefficients in interpolating spline
bm_tabpos : find position in monotonic table

Linear systems

bm_matdetg : matrix determinant (Givens rotations)
bm_matdetlu : matrix determinant (LU decomposition)
bm_matinvg : matrix inverse (Givens rotations)
bm_matinvlu : matrix inverse (LU decomposition)
bm_matludecomp : matrix LU decomposition
bm_matlumsubst : LU back-substitution (multiple vectors)
bm_matlusubst : LU back-substitution
bm_matsolcg : solution of matrix equation (conjugate gradients)
bm_matsolg : solution of matrix equation (Givens rotations)
bm_matsollu : solution of matrix equation (LU decomposition)
bm_muptrisol : solution of upper triangular matrix equation (multiple vectors)
bm_orthoggs : Gram-Schmidt orthogonalisation
bm_sparsematsolcg : solution of sparse matrix equation (conjugate gradients)
bm_tridiagludecomp : LU decomposition of tridiagonal matrix equation
bm_tridiaglusubst : LU back-substitution of tridiagonal matrix equation
bm_tridiagsollu : solution of tridiagonal matrix equation
bm_uptrisol : solution of upper triangular matrix equation
bm_vanmonfitsol : solution of Vandermonde matrix equation (fitting type)
bm_vanmonmomsol : solution of Vandermonde matrix equation (moments type)

Matrix utilities

bm_mattotel : sum of elements
bm_mattrace : trace of matrix
bm_matabstotel : sum of absolute values of elements
bm_matnorm : norm of matrix
bm_matabsbigel : find element of largest magnitude
bm_matabstinel : find element of smallest magnitude
bm_matadd : add matrices
bm_mateq : set matrices equal
bm_matfilter : set small values to zero
bm_matidentity : create identity matrix
bm_matmult : multiply matrices
bm_matmulttran : multiply matrix by transpose of matrix
bm_matmultvec : multiply vector by matrix
bm_matread : simple read of matrix elements
bm_matset : set matrix elements to a single value
bm_matshow : display matrix
bm_matsmult : multiply matrix by scalar
bm_matsub : subtract matrices
bm_mattran : transpose matrix
bm_mattranmult : multiply matrix by transpose of matrix
bm_mattranmultvec : multiply vector by transpose of matrix
bm_matblockprod : block (Kronecker) product of two matrices
bm_matstackhoriz : combine two matrices by `stacking side-by-side'
bm_matstackvert : combine two matrices by `stacking vertically'

Minimisation and maximisation

bm_minbis1D : 1D bisection
bm_minbisND : ND bisection
bm_minbisd1D : 1D bisection (derivatives only)
bm_minbrack1D : 1D bracketing
bm_minbrackND : ND bracketing
bm_mincgND : ND conjugate gradient
bm_mincgnumND : ND conjugate gradient, numerical derivatives
bm_mindumbND : ND `dumb' method
bm_minnr1D : 1D Newton-Raphson
bm_minnrND : ND Newton-Raphson
bm_mintr1D : 1D trust region
bm_mintrND : ND trust region

Solution of ordinary differential equations

bm_rkaccint : Runge-Kutta with accuracy checking
bm_rkint : Runge-Kutta
bm_rksaccint : Runge-Kutta with flexible stop conditions and accuracy checking
bm_rksaccinthist : Runge-Kutta with flexible stop conditions and accuracy checking, variable histories stored
bm_rksstep : single Runge-Kutta step with flexible stop conditions
bm_rkstep : single Runge-Kutta step

Solution of partial differential equations

bm_dynampc1D : 1D time-dependent predictor-corrector
bm_dynampcrec2D : 2D time-dependent predictor-corrector (rectangular mesh)
bm_ellipconsorreg1D : 1D elliptic, constant coefficients, SOR method, regular mesh
bm_ellipconsorreg2D : 2D elliptic, constant coefficients, SOR method, regular mesh
bm_ellipsor1D : 1D elliptic, SOR method
bm_ellipsorrec2D : 2D elliptic, SOR method, rectangular mesh
bm_ellipsorreg1D : 1D elliptic, SOR method, regular mesh
bm_ellipsorreg2D : 2D elliptic, SOR method, regular mesh

Random numbers

bm_randisexp : generate a random number (exponential distribution)
bm_randisexpgen : generate a random number (general exponential distribution)
bm_randisgauss : generate a random number (Gaussian distribution)
bm_randisgaussgen : generate a random number (general Gaussian distribution)
bm_randislorentz : generate a random number (Lorentz distribution)
bm_ransub : generate a random number (uniform distribution)
bm_ranoutcome : random choice between discrete outcomes with different probabilities
bm_setransub : seed random number generator

Root-finding

bm_rootbis1D : 1D bisection
bm_rootnr1D : 1D Newton-Raphson
bm_rootquad : quadratic
bm_rootsfuncbis : all roots of arbitrary function by bisection
bm_rootspolybis : all roots of polynomial by bisection
bm_synthdiv : synthetic division of polynomials

Sorting

bm_index : ordering indices
bm_indexheap : index using heapsort
bm_indexinsert : index using insertion
bm_indexrank : rank given ordering indices
bm_indexshell : index using shell method
bm_indexsort : sort given ordering indices
bm_sort : sort
bm_sortheap : heapsort
bm_sortinsert : insertion sort
bm_sortshell : shell sort

Statistics

bm_lincor : linear correlation coefficient
bm_moment : moments
bm_meanabsdev : mean and absolute deviation
bm_meanvarsd : mean. variance and standard deviation
bm_runmeanvarsd : running mean, variance and standard deviation

Integral transforms

bm_fftcomp1D : 1D complex fast Fourier transform
bm_fftcompnd : ND complex fast Fourier transform

Vectors

bm_veccross2D : cross product (2D)
bm_vecdot : inner product
bm_vecdot2D : inner product (2D)
bm_vecdot3D : inner product (3D)
bm_vectotel : sum of elements
bm_vecabstotel : sum of absolute values of elements
bm_veclen : length
bm_veclen2D : length (2D)
bm_veclen3D : length (3D)
bm_vecnorm : norm
bm_vecnorm2D : norm (2D)
bm_vecnorm3D : norm (3D)
bm_vecabsbigel : find largest absolute element
bm_vecabstinel : find smallest absolute element
bm_vecadd : add vectors
bm_vecadd2D : add vectors (2D)
bm_vecadd3D : add vectors (3D)
bm_veccross3D : cross product (3D)
bm_vecdirprod : outer product
bm_veceq : set vectors equal
bm_veceq2D : set vectors equal (2D)
bm_veceq3D : set vectors equal (3D)
bm_vecfilter : set small elements to zero
bm_vecnormalise : normalise vector
bm_vecnormalise2D : normalise vector (2D)
bm_vecnormalise3D : normalise vector (3D)
bm_vecread : read elements
bm_vecread2D : read elements (2D)
bm_vecread3D : read elements (3D)
bm_vecset : set elements to a single value
bm_vecset2D : set elements to a single value (2D)
bm_vecset3D : set elements to a single value (3D)
bm_vecshow : display vector
bm_vecshow2D : display vector (2D)
bm_vecshow3D : display vector (3D)
bm_vecsmult : multiply vector by scalar
bm_vecsmult2D : multiply vector by scalar (2D)
bm_vecsmult3D : multiply vector by scalar (3D)
bm_vecsub : subtract vectors
bm_vecsub2D : subtract vectors (2D)
bm_vecsub3D : subtract vectors (3D)
bm_wedge1 : wedge product