Classes | Typedefs | Enumerations | Functions | Variables
o2scl Namespace Reference

The main O2scl namespace. More...

Classes

class  anneal_base
 Simulated annealing base. More...
 
class  anneal_gsl
 Multidimensional minimization by simulated annealing (GSL) More...
 
class  anneal_mt
 Multidimensional minimization by simulated annealing (Boost multi-threaded version) More...
 
class  astep_base
 Adaptive stepper [abstract base]. More...
 
class  astep_gsl
 Adaptive ODE stepper (GSL) More...
 
class  astep_nonadapt
 An non-adaptive stepper implementation of astep_base. More...
 
class  bin_size
 Determine bin size (CERNLIB) More...
 
class  calculator
 Evaluate a mathematical expression in a string. More...
 
class  cheb_approx
 Chebyshev approximation (GSL) More...
 
class  chi_fit_funct
 Standard fitting function based on one-dimensional data with a numerical Jacobian. More...
 
class  cli
 Configurable command-line interface. More...
 
class  cli_readline
 An extension to o2scl::cli which uses readline. More...
 
struct  cmd_line_arg
 A command-line argument for o2scl::cli. More...
 
class  columnify
 Create nicely formatted columns from a table of strings. More...
 
class  comm_option_fptr
 Function pointer for o2scl::cli command function. More...
 
class  comm_option_funct
 Base for o2scl::cli command function. More...
 
class  comm_option_mfptr
 Member function pointer for o2scl::cli command function. More...
 
struct  comm_option_s
 Command for interactive mode in o2scl::cli. More...
 
class  const_vector_range_gen
 Experimental const vector range object. More...
 
class  contour
 Calculate contour lines from a two-dimensional data set. More...
 
class  contour_line
 A contour line. More...
 
class  convert_units
 Convert units. More...
 
class  cubic_complex
 Solve a cubic polynomial with complex coefficients and complex roots [abstract base]. More...
 
class  cubic_complex_std
 Solve a cubic with complex coefficients and complex roots. More...
 
class  cubic_real
 Solve a cubic polynomial with real coefficients and real roots [abstract base]. More...
 
class  cubic_real_coeff
 Solve a cubic polynomial with real coefficients and complex roots [abstract base]. More...
 
class  cubic_real_coeff_cern
 Solve a cubic with real coefficients and complex roots (CERNLIB) More...
 
class  cubic_real_coeff_gsl
 Solve a cubic with real coefficients and complex roots (GSL) More...
 
class  deriv_base
 Numerical differentiation base [abstract base]. More...
 
class  deriv_cern
 Numerical differentiation routine (CERNLIB) More...
 
class  deriv_eqi
 Derivatives for equally-spaced abscissas. More...
 
class  deriv_gsl
 Numerical differentiation (GSL) More...
 
class  diff_evo
 Multidimensional minimization by the differential evolution method. More...
 
class  diff_evo_adapt
 Multidimensional minimization by the differential evolution method. More...
 
class  edge_crossings
 Edges for the contour class. More...
 
class  err_hnd_cpp
 Error handler to throw C++ exceptions. More...
 
class  err_hnd_gsl
 The error handler. More...
 
class  err_hnd_type
 Class defining an error handler [abstract base]. More...
 
class  exc_exception
 Generic exception. More...
 
class  exc_invalid_argument
 Invalid argument exception. More...
 
class  exc_ios_failure
 I/O failure error exception. More...
 
class  exc_logic_error
 Logic error exception. More...
 
class  exc_overflow_error
 Overflow error runtime exception. More...
 
class  exc_range_error
 Range error runtime exception. More...
 
class  exc_runtime_error
 Generic runtime error exception. More...
 
class  expval_base
 Expectation value base class. More...
 
class  expval_matrix
 Matrix expectation value. More...
 
class  expval_scalar
 Scalar expectation value. More...
 
class  expval_vector
 Vector expectation value. More...
 
class  fit_base
 Non-linear least-squares fitting [abstract base]. More...
 
class  fit_bayes
 Fit a function to data using Bayesian methods. More...
 
class  fit_fix_pars
 Multidimensional fitting class fixing some parameters and varying others. More...
 
class  fit_funct11_strings
 String fitting function. More...
 
class  fit_linear
 Linear least-squares fitting class (GSL) More...
 
class  fit_min
 Non-linear least-squares fitting class with generic minimizer. More...
 
class  fit_nonlin
 Non-linear least-squares fitting class (GSL) More...
 
class  fit_nonlin_b
 Base routines for the nonlinear fitting classes. More...
 
class  format_float
 Format a floating point number into a Latex or HTML string. More...
 
class  funct11_string
 One-dimensional function from a string. More...
 
class  funct_gsl
 A wrapper to specify o2scl::funct11 objects to GSL. More...
 
class  gen_fit_funct
 Generalized fitting function [abstract base]. More...
 
class  gen_test_number
 Generate number sequence for testing. More...
 
class  gradient
 Class for automatically computing gradients [abstract base]. More...
 
class  gradient_gsl
 Simple automatic computation of gradient by finite differencing. More...
 
class  gsl_matrix_wrap
 A simple convenience wrapper for GSL matrix objects. More...
 
class  gsl_tolerance
 Convergence test similar to gsl_root_test_interval() for root_toms748. More...
 
class  gsl_vector_wrap
 A simple convenience wrapper for GSL vector objects. More...
 
class  hist
 A one-dimensional histogram class. More...
 
class  hist_2d
 A two-dimensional histogram class. More...
 
class  inte
 Base integration class [abstract base]. More...
 
class  inte_adapt_cern
 Adaptive integration (CERNLIB) More...
 
class  inte_cauchy_cern
 Cauchy principal value integration (CERNLIB) More...
 
class  inte_cheb_gsl
 Chebyshev integration base class (GSL) More...
 
class  inte_cubature_base
 Base class for integration routines from the Cubature library. More...
 
class  inte_gauss56_cern
 5,6-point Gaussian quadrature (CERNLIB) More...
 
class  inte_gauss_cern
 Gaussian quadrature (CERNLIB) More...
 
class  inte_gen
 Generalized multi-dimensional integration [abstract base]. More...
 
class  inte_gsl
 GSL integration base. More...
 
class  inte_hcubature
 Adaptive multidimensional integration on hyper-rectangles using cubature rules from the Cubature library. More...
 
class  inte_kronrod_gsl
 Basic Gauss-Kronrod integration class (GSL) More...
 
class  inte_multi
 Multi-dimensional integration over a hypercube [abstract base]. More...
 
class  inte_pcubature
 Integration by p-adaptive cubature from the Cubature library. More...
 
class  inte_qag_gsl
 Adaptive numerical integration of a function (without singularities) on a bounded interval (GSL) More...
 
class  inte_qagi_gsl
 Integrate a function over the interval $ (-\infty,\infty) $ (GSL) More...
 
class  inte_qagil_gsl
 Integrate a function over the interval $ (-\infty, b] $ (GSL) More...
 
class  inte_qagiu_gsl
 Integrate a function over the interval $ [a, \infty) $ (GSL) More...
 
class  inte_qags_gsl
 Integrate a function with a singularity (GSL) More...
 
class  inte_qawc_gsl
 Adaptive Cauchy principal value integration (GSL) More...
 
class  inte_qawf_gsl_cos
 Adaptive integration a function with finite limits of integration (GSL) More...
 
class  inte_qawf_gsl_sin
 Adaptive integration for oscillatory integrals (GSL) More...
 
class  inte_qawo_gsl_cos
 Adaptive integration a function with finite limits of integration (GSL) More...
 
class  inte_qawo_gsl_sin
 Adaptive integration for oscillatory integrals (GSL) More...
 
class  inte_qaws_gsl
 Adaptive integration with with algebraic-logarithmic singularities at the end-points (GSL) More...
 
class  inte_qng_gsl
 Non-adaptive integration from a to b (GSL) More...
 
class  inte_singular_gsl
 Base class for integrating a function with a singularity (GSL) More...
 
class  inte_transform_gsl
 Integrate a function with a singularity (GSL) [abstract base]. More...
 
class  inte_workspace_gsl
 Integration workspace for the GSL integrators. More...
 
class  interp
 Interpolation class for general vectors. More...
 
class  interp2_base
 Two-dimensional interpolation base class [abstract]. More...
 
class  interp2_direct
 Bilinear or bicubic two-dimensional interpolation. More...
 
class  interp2_eqi
 Two-dimensional interpolation for equally-spaced intervals. More...
 
class  interp2_neigh
 Nearest-neighbor interpolation in two dimensions. More...
 
class  interp2_planar
 Interpolate among two independent variables with planes. More...
 
class  interp2_seq
 Two-dimensional interpolation class by successive one-dimensional interpolation. More...
 
class  interp_akima
 Akima spline interpolation (GSL) More...
 
class  interp_akima_peri
 Akima spline interpolation with periodic boundary conditions (GSL) More...
 
class  interp_array
 A specialization of interp for C-style double arrays. More...
 
class  interp_array_vec
 A specialization of o2scl::interp_vec for C-style arrays. More...
 
class  interp_base
 Base low-level interpolation class [abstract base]. More...
 
class  interp_cspline
 Cubic spline interpolation (GSL) More...
 
class  interp_cspline_peri
 Cubic spline interpolation with periodic boundary conditions (GSL) More...
 
class  interp_linear
 Linear interpolation (GSL) More...
 
class  interp_monotonic
 Monotonicity-preserving interpolation. More...
 
class  interp_steffen
 Steffen's monotonicity-preserving interpolation. More...
 
class  interp_vec
 Interpolation class for pre-specified vector. More...
 
class  interpm_idw
 Multi-dimensional interpolation by inverse distance weighting. More...
 
class  jacobian
 Base for providing a numerical jacobian [abstract base]. More...
 
class  jacobian_exact
 A direct calculation of the jacobian using a deriv_base object. More...
 
class  jacobian_gsl
 Simple automatic Jacobian. More...
 
class  lib_settings_class
 A class to manage global library settings. More...
 
class  matrix_column_gen
 Generic object which represents a column of a matrix. More...
 
class  matrix_row_gen
 Generic object which represents a row of a matrix. More...
 
class  mcarlo
 Monte-Carlo integration [abstract base]. More...
 
class  mcarlo_miser
 Multidimensional integration using the MISER Monte Carlo algorithm (GSL) More...
 
class  mcarlo_plain
 Multidimensional integration using plain Monte Carlo (GSL) More...
 
class  mcarlo_vegas
 Multidimensional integration using Vegas Monte Carlo (GSL) More...
 
class  mcmc_base
 A generic MCMC simulation class. More...
 
class  mcmc_cli
 MCMC class with a command-line interface. More...
 
class  mcmc_mpi
 MCMC with MPI and HDF5 table I/O. More...
 
class  mcmc_para_base
 A generic MCMC simulation class. More...
 
class  mcmc_para_table
 A generic MCMC simulation class writing data to a o2scl::table_units object. More...
 
class  mcmc_table
 A generic MCMC simulation class writing data to a o2scl::table_units object. More...
 
class  min_base
 One-dimensional minimization [abstract base]. More...
 
class  min_bkt_base
 One-dimensional bracketing minimization [abstract base]. More...
 
class  min_brent_boost
 One-dimensional minimization using Brent's method (GSL) More...
 
class  min_brent_gsl
 One-dimensional minimization using Brent's method (GSL) More...
 
class  min_cern
 One-dimensional minimization (CERNLIB) More...
 
class  min_de_base
 One-dimensional minimization using derivatives [abstract base]. More...
 
class  min_quad_golden
 Minimization of a function using the safeguarded step-length algorithm of Gill and Murray [GSL]. More...
 
class  mm_funct11_strings
 Array of multi-dimensional functions in an array of strings. More...
 
class  mmin_base
 Multidimensional minimization [abstract base]. More...
 
class  mmin_bfgs2
 Multidimensional minimization by the BFGS algorithm (GSL) More...
 
class  mmin_conf
 Multidimensional minimization by the Fletcher-Reeves conjugate gradient algorithm (GSL) More...
 
class  mmin_conp
 Multidimensional minimization by the Polak-Ribiere conjugate gradient algorithm (GSL) More...
 
class  mmin_constr
 Constrained multidimensional minimization (OOL) [abstract base]. More...
 
class  mmin_constr_gencan
 Constrained minimization by the "GENCAN" method (OOL) More...
 
class  mmin_constr_pgrad
 Constrained minimization by the projected gradient method (OOL) More...
 
class  mmin_constr_spg
 Constrained minimization by the spectral projected gradient method (OOL) More...
 
class  mmin_fix_params
 Multidimensional minimizer fixing some parameters and varying others. More...
 
class  mmin_gsl_base
 Base minimization routines for mmin_conf and mmin_conp. More...
 
class  mmin_linmin_gsl
 The line minimizer for mmin_bfgs2. More...
 
class  mmin_simp2
 Multidimensional minimization by the Simplex method (v2) (GSL) More...
 
class  mmin_wrap_gsl
 Virtual base for the mmin_bfgs2 wrapper. More...
 
class  mmin_wrapper_gsl
 Wrapper class for the mmin_bfgs2 minimizer. More...
 
class  mroot
 Multidimensional root-finding [abstract base]. More...
 
class  mroot_broyden
 Multidimensional root-finding using Broyden's method (GSL) More...
 
class  mroot_cern
 Multi-dimensional mroot-finding routine (CERNLIB) More...
 
class  mroot_hybrids
 Multidimensional root-finding algorithm using Powell's Hybrid method (GSL) More...
 
class  mroot_hybrids_arma_qr_econ
 A version of mroot_hybrids which uses Armadillo for the QR decomposition. More...
 
class  mroot_hybrids_base
 Base functions for mroot_hybrids. More...
 
class  mroot_hybrids_eigen
 A version of mroot_hybrids which uses Eigen for the QR decomposition. More...
 
class  multi_funct11_strings
 A multi-dimensional function from a string. More...
 
class  ode_bsimp_gsl
 Bulirsch-Stoer implicit ODE stepper (GSL) More...
 
class  ode_bv_mshoot
 Solve boundary-value ODE problems by multishooting with a generic nonlinear solver. More...
 
class  ode_bv_multishoot
 Solve a ODE boundary value problem by multishooting. More...
 
class  ode_bv_shoot
 Solve boundary-value ODE problems by shooting from one boundary to the other. More...
 
class  ode_bv_shoot_grid
 Solve boundary-value ODE problems by shooting from one boundary to the other on a grid. More...
 
class  ode_bv_solve
 Base class for boundary-value ODE solvers. More...
 
class  ode_control_gsl
 Control structure for astep_gsl. More...
 
class  ode_funct11_strings
 One-dimensional function from strings. More...
 
class  ode_it_solve
 ODE solver using a generic linear solver to solve finite-difference equations. More...
 
class  ode_iv_solve
 Solve an initial-value ODE problems given an adaptive ODE stepper. More...
 
class  ode_iv_table
 Solve an initial-value ODE problem and store the result in a table object. More...
 
class  ode_rk8pd_gsl
 Embedded Runge-Kutta Prince-Dormand ODE stepper (GSL) More...
 
class  ode_rkck_gsl
 Cash-Karp embedded Runge-Kutta ODE stepper (GSL) More...
 
class  ode_rkf45_gsl
 Runge-Kutta-Fehlberg embedded Runge-Kutta ODE stepper (GSL) More...
 
class  ode_step
 ODE stepper base [abstract base]. More...
 
class  permutation
 A class for representing permutations. More...
 
class  pinside
 Test line intersection and point inside polygon. More...
 
class  poly_complex
 Solve a general polynomial with complex coefficients [abstract base]. More...
 
class  poly_real_coeff
 Solve a general polynomial with real coefficients and complex roots [abstract base]. More...
 
class  poly_real_coeff_gsl
 Solve a general polynomial with real coefficients (GSL) More...
 
class  polylog
 Polylogarithms (approximate) $ Li_n(x)$. More...
 
class  prob_cond_mdim
 A multi-dimensional conditional probability density function. More...
 
class  prob_cond_mdim_gaussian
 A multi-dimensional Gaussian conditional probability density function. More...
 
class  prob_cond_mdim_invar
 A multi-dimensional conditional probability density function independent of the input. More...
 
class  prob_cond_mdim_rand_walk
 A constrained random walk in the shape of a hypercube. More...
 
class  prob_dens_frange
 A one-dimensional probability density over a finite range. More...
 
class  prob_dens_func
 A one-dimensional probability density function. More...
 
class  prob_dens_gaussian
 A one-dimensional Gaussian probability density. More...
 
class  prob_dens_hist
 Probability density function based on a histogram. More...
 
class  prob_dens_lognormal
 Lognormal density function. More...
 
class  prob_dens_mdim
 A multi-dimensional probability density function. More...
 
class  prob_dens_mdim_factor
 A multidimensional distribution formed by the product of several one-dimensional distributions. More...
 
class  prob_dens_mdim_gaussian
 A multi-dimensional Gaussian probability density function. More...
 
class  prob_dens_positive
 A one-dimensional probability density over the positive real numbers. More...
 
class  prob_dens_uniform
 A uniform one-dimensional probability density over a finite range. More...
 
class  quadratic_complex
 Solve a quadratic polynomial with complex coefficients and complex roots [abstract base]. More...
 
class  quadratic_complex_std
 Solve a quadratic with complex coefficients and complex roots. More...
 
class  quadratic_real
 Solve a quadratic polynomial with real coefficients and real roots [abstract base]. More...
 
class  quadratic_real_coeff
 Solve a quadratic polynomial with real coefficients and complex roots [abstract base]. More...
 
class  quadratic_real_coeff_gsl
 Solve a quadratic with real coefficients and complex roots (GSL) More...
 
class  quartic_complex
 Solve a quartic polynomial with complex coefficients and complex roots [abstract base]. More...
 
class  quartic_complex_simple
 Solve a quartic with complex coefficients and complex roots. More...
 
class  quartic_real
 Solve a quartic polynomial with real coefficients and real roots [abstract base]. More...
 
class  quartic_real_coeff
 Solve a quartic polynomial with real coefficients and complex roots [abstract base]. More...
 
class  quartic_real_coeff_cern
 Solve a quartic with real coefficients and complex roots (CERNLIB) More...
 
class  quartic_real_gsl
 Solve a quartic with real coefficients and real roots (GSL) More...
 
class  quartic_real_gsl2
 Solve a quartic with real coefficients and real roots (GSL) More...
 
class  quartic_real_simple
 Solve a quartic with real coefficients and real roots. More...
 
class  rng_gsl
 Random number generator (GSL) More...
 
class  rng_gsl_uniform_real
 Desc. More...
 
class  root
 One-dimensional solver [abstract base]. More...
 
class  root_bkt
 One-dimensional bracketing solver [abstract base]. More...
 
class  root_bkt_cern
 One-dimensional root-finding routine (CERNLIB) More...
 
class  root_brent_gsl
 One-dimensional root-finding (GSL) More...
 
class  root_cern
 One-dimensional version of cern_mroot. More...
 
class  root_de
 One-dimensional with solver with derivatives [abstract base]. More...
 
class  root_stef
 Steffenson equation solver (GSL) More...
 
class  root_toms748
 Bracketing solver based the Boost implementation of TOMS 748. More...
 
class  search_vec
 Searching class for monotonic data with caching. More...
 
class  search_vec_ext
 An extended search_vec which is allowed to return the last element. More...
 
class  series_acc
 Series acceleration by Levin u-transform (GSL) More...
 
class  smooth_gsl
 Smooth a GSL vector using GSL bsplines. More...
 
class  table
 Data table class. More...
 
class  table3d
 A data structure containing many slices of two-dimensional data points defined on a grid. More...
 
class  table_units
 Data table class with units. More...
 
class  tensor
 Tensor class with arbitrary dimensions. More...
 
class  tensor1
 Rank 1 tensor. More...
 
class  tensor2
 Rank 2 tensor. More...
 
class  tensor3
 Rank 3 tensor. More...
 
class  tensor4
 Rank 4 tensor. More...
 
class  tensor_grid
 Tensor class with arbitrary dimensions with a grid. More...
 
class  tensor_grid1
 Rank 1 tensor with a grid. More...
 
class  tensor_grid2
 Rank 2 tensor with a grid. More...
 
class  tensor_grid3
 Rank 3 tensor with a grid. More...
 
class  tensor_grid4
 Rank 4 tensor with a grid. More...
 
class  test_mgr
 A class to manage testing and record success and failure. More...
 
class  Token
 Token class for o2scl::calculator. More...
 
struct  TokenBase
 Token base data type for o2scl::calculator. More...
 
class  uniform_grid
 A class representing a uniform linear or logarithmic grid. More...
 
class  uniform_grid_end
 Linear grid with fixed number of bins and fixed endpoint. More...
 
class  uniform_grid_end_width
 Linear grid with fixed endpoint and fixed bin size. More...
 
class  uniform_grid_log_end
 Logarithmic grid with fixed number of bins and fixed endpoint. More...
 
class  uniform_grid_log_end_width
 Logarithmic grid with fixed endpoint and fixed bin size. More...
 
class  uniform_grid_log_width
 Logarithmic grid with fixed number of bins and fixed bin size. More...
 
class  uniform_grid_width
 Linear grid with fixed number of bins and fixed bin size. More...
 
class  uniform_prior
 An unnormalized uniform prior distribution for several variables. More...
 
class  vec_index
 A class to assign string labels to array indices. More...
 
class  vector_range_gen
 Experimental vector range object. More...
 

Typedefs

typedef std::function< double(double)> funct11
 One-dimensional function typedef.
 
typedef std::function< int(size_t, const boost::numeric::ublas::vector< double > &, boost::numeric::ublas::vector< double > &) > mm_funct11
 Array of multi-dimensional functions typedef.
 
typedef std::function< double(size_t, const boost::numeric::ublas::vector< double > &)> multi_funct11
 Multi-dimensional function typedef.
 
typedef std::queue< TokenBase * > TokenQueue_t
 A typedef for a queue of tokens for o2scl::calculator.
 
typedef boost::numeric::ublas::range ub_range
 
typedef boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< double > > ubvector_range
 
typedef boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< size_t > > ubvector_size_t_range
 
typedef std::function< double(size_t, const boost::numeric::ublas::vector< double > &, double)> fit_funct11
 Array of multi-dimensional functions typedef (C++11 version)
 
typedef boost::numeric::ublas::vector< double > ubvector
 
typedef std::function< int(size_t, boost::numeric::ublas::vector< double > &, boost::numeric::ublas::vector< double > &)> grad_funct11
 Array of multi-dimensional functions typedef.
 
typedef std::function< int(size_t, const boost::numeric::ublas::vector< double > &, const boost::numeric::ublas::vector< double > &, boost::numeric::ublas::vector< double > &)> ool_hfunct11
 Hessian product function for o2scl::mmin_constr.
 
typedef std::function< int(double, size_t, const boost::numeric::ublas::vector< double > &, boost::numeric::ublas::vector< double > &)> ode_funct11
 Ordinary differential equation function.
 
typedef std::function< double(size_t, double, boost::numeric::ublas::matrix_row< boost::numeric::ublas::matrix< double > > &)> ode_it_funct11
 Function for iterative solving of ODEs.
 
typedef std::function< int(double, size_t, const boost::numeric::ublas::vector< double > &, boost::numeric::ublas::matrix< double > &, boost::numeric::ublas::vector< double > &) > ode_jac_funct11
 Functor for ODE Jacobians.
 
typedef std::function< int(size_t, boost::numeric::ublas::vector< double > &, size_t, boost::numeric::ublas::vector< double > &, boost::numeric::ublas::matrix< double > &) > jac_funct11
 Jacobian function (not necessarily square)
 

Enumerations

enum  {
  success =0, gsl_failure =-1, gsl_continue =-2, exc_edom =1,
  exc_erange =2, exc_efault =3, exc_einval =4, exc_efailed =5,
  exc_efactor =6, exc_esanity =7, exc_enomem =8, exc_ebadfunc =9,
  exc_erunaway =10, exc_emaxiter =11, exc_ezerodiv =12, exc_ebadtol =13,
  exc_etol =14, exc_eundrflw =15, exc_eovrflw =16, exc_eloss =17,
  exc_eround =18, exc_ebadlen =19, exc_enotsqr =20, exc_esing =21,
  exc_ediverge =22, exc_eunsup =23, exc_eunimpl =24, exc_ecache =25,
  exc_etable =26, exc_enoprog =27, exc_enoprogj =28, exc_etolf =29,
  exc_etolx =30, exc_etolg =31, exc_eof =32, exc_enotfound =33,
  exc_ememtype =34, exc_efilenotfound =35, exc_eindex =36, exc_outsidecons =37
}
 The integer error definitions. More...
 
enum  {
  itp_linear =1, itp_cspline =2, itp_cspline_peri =3, itp_akima =4,
  itp_akima_peri =5, itp_monotonic =6, itp_steffen =7
}
 Interpolation types. More...
 
enum  tokType { NONE, OP, VAR, NUM }
 Token list for o2scl::calculator.
 

Functions

void error_update (int &ret, int err)
 Update an error value err with the value in ret. More...
 
template<class vec_t , class vec2_t >
size_t vector_level_count (double level, size_t n, vec_t &x, vec2_t &y)
 Count level crossings. More...
 
template<class vec_t , class vec2_t >
void vector_find_level (double level, size_t n, vec_t &x, vec2_t &y, std::vector< double > &locs)
 Perform inverse linear interpolation. More...
 
template<class vec_t , class vec2_t >
double vector_integ_linear (size_t n, vec_t &x, vec2_t &y)
 Compute the integral over y(x) using linear interpolation. More...
 
template<class vec_t , class vec2_t >
void vector_invert_enclosed_sum (double sum, size_t n, vec_t &x, vec2_t &y, double &lev, int verbose=0)
 Compute the endpoints which enclose the regions whose integral is equal to sum. More...
 
template<class vec_t , class vec2_t >
void vector_region_parint (size_t n, vec_t &x, vec2_t &y, double frac, std::vector< double > &locs, int verbose=0)
 Find the region enclosing a partial integral.
 
template<class vec_t , class vec2_t >
void vector_bound_parint (size_t n, vec_t &x, vec2_t &y, double frac, double &low, double &high)
 Find the boundaries of the region enclosing a partial integral.
 
template<class data_t >
data_t quadratic_extremum_x (const data_t x1, const data_t x2, const data_t x3, const data_t y1, const data_t y2, const data_t y3)
 Return the x value of the extremum of a quadratic defined by three $ (x,y) $ pairs. More...
 
template<class data_t >
void quadratic_extremum_y_full (const data_t x1, const data_t x2, const data_t x3, const data_t y1, const data_t y2, const data_t y3, const data_t &xmin, const data_t &ymin, const data_t &a, const data_t &b, const data_t &c, const data_t &den)
 Return values related to a quadratic defined by three $ (x,y) $ pairs. More...
 
template<class data_t >
data_t quadratic_extremum_y (const data_t x1, const data_t x2, const data_t x3, const data_t y1, const data_t y2, const data_t y3)
 Return the y value of the extremum of a quadratic defined by three $ (x,y) $ pairs. More...
 
template<class data_t >
void quadratic_extremum_xy (const data_t x1, const data_t x2, const data_t x3, const data_t y1, const data_t y2, const data_t y3, data_t &x, data_t &y)
 Return the (x,y) for the extremum of a quadratic defined by three $ (x,y) $ pairs. More...
 
template<class data_t >
void quadratic_extremum_coeffs (const data_t x1, const data_t x2, const data_t x3, const data_t y1, const data_t y2, const data_t y3, data_t &a, data_t &b, data_t &c)
 Return the (x,y) for the extremum of a quadratic defined by three $ (x,y) $ pairs. More...
 
std::ostream & operator<< (std::ostream &os, const permutation &p)
 Output operator for permutations. More...
 
double constraint (double x, double center, double width, double height)
 Constrain x to be within width of the value given by center. More...
 
double cont_constraint (double x, double center, double width, double height, double tightness=40.0, double exp_arg_limit=50.0)
 Constrain x to be within width of the value given by center. More...
 
double lower_bound (double x, double center, double width, double height)
 Constrain x to be greater than the value given by center. More...
 
double cont_lower_bound (double x, double center, double width, double height, double tightness=40.0, double exp_arg_limit=50.0)
 Constrain x to be greater than the value given by center. More...
 
Matrix output functions from columnify.h
template<class mat_t >
int matrix_out (std::ostream &os, size_t nrows, size_t ncols, mat_t &A)
 A operator for simple matrix output using operator() More...
 
template<class mat_t >
int matrix_out (std::ostream &os, mat_t &A)
 A operator for simple matrix output using operator() More...
 
template<class mat_t >
int matrix_trans_out (std::ostream &os, size_t nrows, size_t ncols, mat_t &A)
 A operator for simple matrix output using operator() More...
 
template<class mat_t >
int matrix_trans_out (std::ostream &os, mat_t &A)
 A operator for simple matrix output using operator() More...
 
template<class mat_t >
int array_2d_out (std::ostream &os, size_t nrows, size_t ncols, mat_t &A)
 A operator for simple matrix output using operator[]. More...
 
template<class mat_t >
int array_2d_trans_out (std::ostream &os, size_t nrows, size_t ncols, mat_t &A)
 A operator for simple matrix output using operator[]. More...
 
The error handler function
void set_err_fn (const char *desc, const char *file, int line, int errnum)
 Call the error handler.
 
Functions from misc.h
double fermi_function (double E, double mu, double T, double limit=40.0)
 Calculate a Fermi-Dirac distribution function safely. More...
 
int pipe_cmd_string (std::string cmd, std::string &result, bool err_on_fail=true, int nmax=80)
 Store the first line from the output of the shell command cmd up to nmax characters in result. More...
 
std::string pipe_cmd_string (std::string cmd, int nmax=80)
 Return the first line from the output of the shell command cmd up to nmax characters. More...
 
template<class string_arr_t >
void screenify (size_t nin, const string_arr_t &in_cols, std::vector< std::string > &out_cols, size_t max_size=80)
 Reformat the columns for output of width size. More...
 
size_t count_words (std::string str)
 Count the number of words in the string str. More...
 
void remove_whitespace (std::string &s)
 Remove all whitespace from the string s. More...
 
std::string binary_to_hex (std::string s)
 Take a string of binary quads and compress them to hexadecimal digits. More...
 
void RGBtoHSV (double r, double g, double b, double &h, double &s, double &v)
 Convert RGB to HSV color. More...
 
void HSVtoRGB (double h, double s, double v, double &r, double &g, double &b)
 Convert RGB to HSV color. More...
 
Functions in string_conv.h
std::string ptos (void *p)
 Convert a pointer to a string. More...
 
std::string itos (int x)
 Convert an integer to a string.
 
std::string szttos (size_t x)
 Convert a size_t to a string.
 
std::string btos (bool b)
 Convert a boolean value to a string. More...
 
std::string dtos (double x, int prec=6, bool auto_prec=false)
 Convert a double to a string. More...
 
size_t size_of_exponent (double x)
 Returns the number of characters required to display the exponent of x in scientific mode. More...
 
std::string dtos (double x, std::ostream &format)
 Convert a double to a string using a specified format.
 
int stoi (std::string s, bool err_on_fail=true)
 Convert a string to an integer. More...
 
size_t stoszt (std::string s, bool err_on_fail=true)
 Convert a string to a size_t. More...
 
bool stob (std::string s, bool err_on_fail=true)
 Convert a string to a boolean value. More...
 
double stod (std::string s, bool err_on_fail=true)
 Convert a string to a double. More...
 
bool has_minus_sign (double *x)
 Find out if the number pointed to by x has a minus sign. More...
 
bool is_number (std::string s)
 Return true if the string s is likely a integral or floating point number. More...
 
double function_to_double (std::string s, bool err_on_fail=true)
 Convert a formula to a double. More...
 
void split_string (std::string str, std::vector< std::string > &sv)
 Split a string into words using whitespace for delimiters and (partially) respecting quotes. More...
 
void rewrap (std::string str, std::vector< std::string > &sv, size_t ncol=79)
 Rewrap a string into a single column, avoiding strings less than a particular number of characters.
 
Copying vectors and matrices
template<class vec_t , class vec2_t >
void vector_copy (const vec_t &src, vec2_t &dest)
 Simple vector copy. More...
 
template<class vec_t , class vec2_t >
void vector_copy (size_t N, const vec_t &src, vec2_t &dest)
 Simple vector copy of the first N elements. More...
 
template<class mat_t , class mat2_t >
void matrix_copy (mat_t &src, mat2_t &dest)
 Simple matrix copy. More...
 
template<class mat_t , class mat2_t >
void matrix_copy (size_t M, size_t N, mat_t &src, mat2_t &dest)
 Simple matrix copy of the first $ (M,N) $ matrix elements. More...
 
Tranpositions
template<class mat_t , class mat2_t >
void matrix_transpose (mat_t &src, mat2_t &dest)
 Simple transpose. More...
 
template<class mat_t , class mat2_t >
void matrix_transpose (size_t m, size_t n, mat_t &src, mat2_t &dest)
 Simple transpose of the first $ (m,n) $ matrix elements. More...
 
template<class mat_t , class data_t >
void matrix_transpose (mat_t &src)
 Simple transpose in-place. More...
 
template<class mat_t , class data_t >
void matrix_transpose (size_t m, size_t n, mat_t &src)
 Simple in-place transpose of the first $ (m,n) $ matrix elements. More...
 
Upper and lower triangular functions
template<class mat_t >
bool matrix_is_lower (mat_t &src)
 Simple test that a matrix is lower triangular.
 
template<class mat_t >
bool matrix_is_upper (mat_t &src)
 Simple test that a matrix is upper triangular.
 
template<class mat_t >
void matrix_make_lower (mat_t &src)
 Make a matrix lower triangular by setting the upper triangular entries to zero.
 
template<class mat_t >
void matrix_make_upper (mat_t &src)
 Make a matrix upper triangular by setting the lower triangular entries to zero.
 
template<class mat_t >
bool matrix_is_lower (size_t m, size_t n, mat_t &src)
 Simple test that a matrix is lower triangular for the first m rows and n columns.
 
template<class mat_t >
bool matrix_is_upper (size_t m, size_t n, mat_t &src)
 Simple test that a matrix is upper triangular for the first m rows and n columns.
 
template<class mat_t >
void matrix_make_lower (size_t m, size_t n, mat_t &src)
 Make the first m rows and n columns of a matrix lower triangular by setting the upper triangular entries to zero.
 
template<class mat_t >
void matrix_make_upper (size_t m, size_t n, mat_t &src)
 Make the first m rows and n columns of a matrix upper triangular by setting the lower triangular entries to zero.
 
Swapping parts of vectors and matrices
template<class vec_t , class vec2_t , class data_t >
void vector_swap (size_t N, vec_t &v1, vec2_t &v2)
 Swap the first N elements of two vectors. More...
 
template<class vec_t , class vec2_t , class data_t >
void vector_swap (vec_t &v1, vec2_t &v2)
 Swap all elements in two vectors. More...
 
template<class vec_t , class vec2_t >
void vector_swap_double (size_t N, vec_t &v1, vec2_t &v2)
 Swap of of the first N elements of two double-precision vectors. More...
 
template<class vec_t , class vec2_t >
void vector_swap_double (vec_t &v1, vec2_t &v2)
 Swap of all the elements in two double-precision vectors. More...
 
template<class vec_t , class data_t >
void vector_swap (vec_t &v, size_t i, size_t j)
 Swap two elements in a vector. More...
 
template<class vec_t >
void vector_swap_double (vec_t &v, size_t i, size_t j)
 Swap two elements in a double-precision vector. More...
 
template<class mat_t , class mat2_t , class data_t >
void matrix_swap (size_t M, size_t N, mat_t &v1, mat2_t &v2)
 Swap of the first $ (M,N) $ elements in two matrices. More...
 
template<class mat_t , class mat2_t , class data_t >
void matrix_swap_double (size_t M, size_t N, mat_t &m1, mat2_t &m2)
 Swap of the first $ (M,N) $ elements in two double-precision matrices. More...
 
template<class mat_t , class data_t >
void matrix_swap (mat_t &m, size_t i1, size_t j1, size_t i2, size_t j2)
 Swap two elements in a matrix. More...
 
template<class mat_t >
void matrix_swap_double (mat_t &m, size_t i1, size_t j1, size_t i2, size_t j2)
 Swap two elements in a double-precision matrix. More...
 
template<class mat_t , class data_t >
void matrix_swap_cols (size_t M, mat_t &m, size_t j1, size_t j2)
 Swap the first M rows of two columns in a matrix. More...
 
template<class mat_t >
void matrix_swap_cols_double (size_t M, mat_t &m, size_t j1, size_t j2)
 Swap the first M rows of two columns in a double-precision matrix. More...
 
template<class mat_t , class data_t >
void matrix_swap_rows (size_t N, mat_t &m, size_t i1, size_t i2)
 Swap the first N columns of two rows in a matrix. More...
 
template<class mat_t >
void matrix_swap_rows_double (size_t N, mat_t &m, size_t i1, size_t i2)
 Swap the first N columns of two rows in a double-precision matrix. More...
 
Sorting vectors
template<class vec_t , class data_t >
void sort_downheap (vec_t &data, size_t n, size_t k)
 Provide a downheap() function for vector_sort()
 
template<class vec_t , class data_t >
void vector_sort (size_t n, vec_t &data)
 Sort a vector (in increasing order) More...
 
template<class vec_t , class vec_size_t >
void sort_index_downheap (size_t N, const vec_t &data, vec_size_t &order, size_t k)
 Provide a downheap() function for vector_sort_index()
 
template<class vec_t , class vec_size_t >
void vector_sort_index (size_t n, const vec_t &data, vec_size_t &order)
 Create a permutation which sorts a vector (in increasing order) More...
 
template<class vec_t >
void vector_sort_double (size_t n, vec_t &data)
 Sort a vector of doubles (in increasing order) More...
 
Smallest or largest subset functions
template<class vec_t , class data_t >
void vector_smallest (size_t n, vec_t &data, size_t k, vec_t &smallest)
 Find the k smallest entries of the first n elements of a vector. More...
 
template<class vec_t , class data_t >
void vector_smallest (vec_t &data, size_t k, vec_t &smallest)
 Find the k smallest entries of a vector of a vector. More...
 
template<class vec_t , class data_t , class vec_size_t >
void vector_smallest_index (size_t n, vec_t &data, size_t k, vec_size_t &index)
 Find the indexes of the k smallest entries among the first n entries of a vector. More...
 
template<class vec_t , class data_t , class vec_size_t >
void vector_smallest_index (vec_t &data, size_t k, vec_size_t &index)
 Find the indexes of the k smallest entries of a vector.
 
template<class vec_t , class data_t >
void vector_largest (size_t n, vec_t &data, size_t k, vec_t &largest)
 Find the k largest entries of the first n elements of a vector. More...
 
template<class vec_t , class data_t >
void vector_largest (vec_t &data, size_t k, vec_t &largest)
 Find the k largest entries of a vector of a vector. More...
 
Vector minimum and maximum functions
template<class vec_t , class data_t >
data_t vector_max_value (size_t n, const vec_t &data)
 Compute the maximum of the first n elements of a vector.
 
template<class vec_t , class data_t >
data_t vector_max_value (const vec_t &data)
 Compute the maximum value of a vector.
 
template<class vec_t , class data_t >
size_t vector_max_index (size_t n, const vec_t &data)
 Compute the index which holds the maximum of the first n elements of a vector.
 
template<class vec_t , class data_t >
void vector_max (size_t n, const vec_t &data, size_t &index, data_t &val)
 Compute the maximum of the first n elements of a vector.
 
template<class vec_t , class data_t >
data_t vector_min_value (size_t n, const vec_t &data)
 Compute the minimum of the first n elements of a vector.
 
template<class vec_t , class data_t >
data_t vector_min_value (const vec_t &data)
 Compute the minimum value in a vector.
 
template<class vec_t , class data_t >
size_t vector_min_index (size_t n, const vec_t &data)
 Compute the index which holds the minimum of the first n elements of a vector.
 
template<class vec_t , class data_t >
void vector_min (size_t n, const vec_t &data, size_t &index, data_t &val)
 Compute the minimum of the first n elements of a vector.
 
template<class vec_t , class data_t >
void vector_minmax_value (size_t n, vec_t &data, data_t &min, data_t &max)
 Compute the minimum and maximum of the first n elements of a vector.
 
template<class vec_t , class data_t >
void vector_minmax_index (size_t n, vec_t &data, size_t &ix_min, size_t &ix_max)
 Compute the minimum and maximum of the first n elements of a vector.
 
template<class vec_t , class data_t >
void vector_minmax (size_t n, vec_t &data, size_t &ix_min, data_t &min, size_t &ix_max, data_t &max)
 Compute the minimum and maximum of the first n elements of a vector.
 
Minima and maxima of vectors through quadratic fit
template<class vec_t , class data_t >
data_t vector_max_quad (size_t n, const vec_t &data)
 Maximum of vector by quadratic fit.
 
template<class vec_t , class data_t >
data_t vector_max_quad (size_t n, const vec_t &x, const vec_t &y)
 Maximum of vector by quadratic fit.
 
template<class vec_t , class data_t >
data_t vector_max_quad_loc (size_t n, const vec_t &x, const vec_t &y)
 Location of vector maximum by quadratic fit.
 
template<class vec_t , class data_t >
data_t vector_min_quad (size_t n, const vec_t &data)
 Minimum of vector by quadratic fit.
 
template<class vec_t , class data_t >
data_t vector_min_quad (size_t n, const vec_t &x, const vec_t &y)
 Minimum of vector by quadratic fit.
 
template<class vec_t , class data_t >
data_t vector_min_quad_loc (size_t n, const vec_t &x, const vec_t &y)
 Location of vector minimum by quadratic fit.
 
Matrix minimum and maximum functions
template<class mat_t , class data_t >
data_t matrix_max_value (size_t m, const size_t n, const mat_t &data)
 Compute the maximum of the lower-left part of a matrix.
 
template<class mat_t , class data_t >
data_t matrix_max_value (const mat_t &data)
 Compute the maximum of a matrix.
 
template<class mat_t >
double matrix_max_value_double (const mat_t &data)
 Compute the maximum of a matrix.
 
template<class mat_t , class data_t >
void matrix_max_index (size_t m, size_t n, const mat_t &data, size_t &i_max, size_t &j_max, data_t &max)
 Compute the maximum of a matrix and return the indices of the maximum element.
 
template<class mat_t , class data_t >
void matrix_max_index (const mat_t &data, size_t &i_max, size_t &j_max, data_t &max)
 Compute the maximum of a matrix and return the indices of the maximum element.
 
template<class mat_t , class data_t >
data_t matrix_min_value (size_t m, size_t n, const mat_t &data)
 Compute the minimum of a matrix.
 
template<class mat_t , class data_t >
data_t matrix_min_value (const mat_t &data)
 Compute the minimum of a matrix.
 
template<class mat_t >
double matrix_min_value_double (const mat_t &data)
 Compute the minimum of a matrix.
 
template<class mat_t , class data_t >
void matrix_min_index (size_t n, size_t m, const mat_t &data, size_t &i_min, size_t &j_min, data_t &min)
 Compute the minimum of a matrix and return the indices of the minimum element.
 
template<class mat_t , class data_t >
void matrix_min_index (const mat_t &data, size_t &i_min, size_t &j_min, data_t &min)
 Compute the minimum of a matrix and return the indices of the minimum element.
 
template<class mat_t , class data_t >
void matrix_minmax (size_t n, size_t m, const mat_t &data, data_t &min, data_t &max)
 Compute the minimum and maximum of a matrix.
 
template<class mat_t , class data_t >
void matrix_minmax (const mat_t &data, data_t &min, data_t &max)
 Compute the minimum and maximum of a matrix.
 
template<class mat_t , class data_t >
void matrix_minmax_index (size_t n, size_t m, const mat_t &data, size_t &i_min, size_t &j_min, data_t &min, size_t &i_max, size_t &j_max, data_t &max)
 Compute the minimum and maximum of a matrix and return their locations.
 
template<class mat_t , class data_t >
data_t matrix_sum (size_t m, size_t n, const mat_t &data)
 Compute the sum of matrix elements.
 
template<class mat_t , class data_t >
data_t matrix_sum (const mat_t &data)
 Compute the sum of matrix elements.
 
Searching vectors and matrices
template<class vec_t >
size_t vector_lookup (size_t n, const vec_t &x, double x0)
 Lookup the value x0 in the first n elements of vector x. More...
 
template<class vec_t >
size_t vector_lookup (const vec_t &x, double x0)
 Lookup element x0 in vector x. More...
 
template<class mat_t >
void matrix_lookup (size_t m, size_t n, const mat_t &A, double x0, size_t &i, size_t &j)
 Lookup an element in the first $(m,n)$ entries in a matrix. More...
 
template<class mat_t >
void matrix_lookup (const mat_t &A, double x0, size_t &i, size_t &j)
 Lookup an element in a matrix. More...
 
template<class vec_t , class data_t >
size_t vector_bsearch_inc (const data_t x0, const vec_t &x, size_t lo, size_t hi)
 Binary search a part of an increasing vector for x0. More...
 
template<class vec_t , class data_t >
size_t vector_bsearch_dec (const data_t x0, const vec_t &x, size_t lo, size_t hi)
 Binary search a part of an decreasing vector for x0. More...
 
template<class vec_t , class data_t >
size_t vector_bsearch (const data_t x0, const vec_t &x, size_t lo, size_t hi)
 Binary search a part of a monotonic vector for x0. More...
 
template<class vec_t , class data_t >
size_t vector_bsearch (const data_t x0, const vec_t &x)
 Binary search a monotonic vector for x0. More...
 
Miscellaneous mathematical functions
template<class vec_t , class data_t >
data_t vector_sum (size_t n, vec_t &data)
 Compute the sum of the first n elements of a vector. More...
 
template<class vec_t , class data_t >
data_t vector_sum (vec_t &data)
 Compute the sum of all the elements of a vector. More...
 
template<class vec_t >
double vector_sum_double (size_t n, vec_t &data)
 Compute the sum of the first n elements of a vector of double-precision numbers. More...
 
template<class vec_t >
double vector_sum_double (vec_t &data)
 Compute the sum of all the elements of a vector of double-precision numbers. More...
 
template<class vec_t , class data_t >
data_t vector_norm (size_t n, const vec_t &x)
 Compute the norm of the first n entries of a vector of floating-point (single or double precision) numbers. More...
 
template<class vec_t , class data_t >
data_t vector_norm (const vec_t &x)
 Compute the norm of a vector of floating-point (single or double precision) numbers.
 
template<class vec_t >
double vector_norm_double (size_t n, const vec_t &x)
 Compute the norm of the first n entries of a vector of double precision numbers. More...
 
template<class vec_t >
double vector_norm_double (const vec_t &x)
 Compute the norm of a vector of double precision numbers.
 
Other vector and matrix functions
template<class vec_t , class data_t >
void vector_rotate (size_t n, vec_t &data, size_t k)
 "Rotate" a vector so that the kth element is now the beginning More...
 
template<class vec_t , class data_t >
void vector_reverse (size_t n, vec_t &data)
 Reverse the first n elements of a vector. More...
 
template<class vec_t , class data_t >
void vector_reverse (vec_t &data)
 Reverse a vector. More...
 
template<class vec_t >
void vector_reverse_double (size_t n, vec_t &data)
 Reverse the first n elements in a vector of double precision numbers. More...
 
template<class vec_t >
void vector_reverse_double (vec_t &data)
 Reverse a vector of double precision numbers. More...
 
template<class mat_t , class mat_row_t >
mat_row_t matrix_row (mat_t &M, size_t row)
 Construct a row of a matrix. More...
 
template<class mat_t , class mat_column_t >
mat_column_t matrix_column (mat_t &M, size_t column)
 Construct a column of a matrix. More...
 
template<class vec_t >
void vector_out (std::ostream &os, size_t n, const vec_t &v, bool endline=false)
 Output the first n elements of a vector to a stream, os. More...
 
template<class vec_t >
void vector_out (std::ostream &os, const vec_t &v, bool endline=false)
 Output a vector to a stream. More...
 
template<class vec_t , class data_t >
void vector_grid (uniform_grid< data_t > g, vec_t &v)
 Fill a vector with a specified grid.
 
template<class mat_t >
void matrix_set_identity (size_t M, size_t N, mat_t &m)
 Set a matrix to unity on the diagonal and zero otherwise.
 
Vector range classes and functions
template<class dat_t >
dat_t * vector_range (dat_t *v, size_t start, size_t last)
 Vector range function for pointers. More...
 
template<class dat_t >
const dat_t * const_vector_range (const dat_t *v, size_t start, size_t last)
 Vector range function for const pointers. More...
 
template<class dat_t >
boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > vector_range (boost::numeric::ublas::vector< dat_t > &v, size_t start, size_t last)
 Vector range function template for ublas vectors. More...
 
template<class dat_t >
const boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > const_vector_range (boost::numeric::ublas::vector< dat_t > &v, size_t start, size_t last)
 Const vector range function template for ublas vectors. More...
 
template<class dat_t >
const boost::numeric::ublas::vector_range< const boost::numeric::ublas::vector< dat_t > > const_vector_range (const boost::numeric::ublas::vector< dat_t > &v, size_t start, size_t last)
 Const vector range function template for const ublas vectors. More...
 
template<class dat_t >
boost::numeric::ublas::vector_range< boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > > vector_range (boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > &v, size_t start, size_t last)
 Vector range function template for ublas vector ranges of ublas vectors. More...
 
template<class dat_t >
const boost::numeric::ublas::vector_range< boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > > const_vector_range (boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > &v, size_t start, size_t last)
 Const vector range function template for ublas vector ranges of ublas vectors. More...
 
template<class dat_t >
const boost::numeric::ublas::vector_range< const boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > > const_vector_range (const boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > &v, size_t start, size_t last)
 Const vector range function template for const ublas vector ranges of ublas vectors. More...
 
template<class dat_t >
const boost::numeric::ublas::vector_range< const boost::numeric::ublas::vector_range< const boost::numeric::ublas::vector< dat_t > > > const_vector_range (const boost::numeric::ublas::vector_range< const boost::numeric::ublas::vector< dat_t > > &v, size_t start, size_t last)
 Const vector range function template for const ublas vector ranges of const ublas vectors. More...
 
template<class data_t >
vector_range_gen< std::vector< data_t > > vector_range (std::vector< data_t > &v, size_t start, size_t last)
 Create a o2scl::vector_range_gen object from a std::vector
 
template<class data_t >
const const_vector_range_gen< std::vector< data_t > > const_vector_range (const std::vector< data_t > &v, size_t start, size_t last)
 Create a o2scl::vector_range_gen object from a std::vector
 
template<class data_t >
const const_vector_range_gen< std::vector< data_t > > const_vector_range (std::vector< data_t > &v, size_t start, size_t last)
 Create a o2scl::vector_range_gen object from a std::vector
 
template<class vec_t >
vector_range_gen< vec_t > vector_range (vector_range_gen< vec_t > &v, size_t start, size_t last)
 Recursively create a o2scl::vector_range_gen object from a vector range.
 
template<class vec_t >
const const_vector_range_gen< vec_t > const_vector_range (vector_range_gen< vec_t > &v, size_t start, size_t last)
 Recursively create a const o2scl::vector_range_gen object from a vector range.
 
template<class vec_t >
const const_vector_range_gen< vec_t > const_vector_range (const vector_range_gen< vec_t > &v, size_t start, size_t last)
 Recursively create a const o2scl::vector_range_gen object from a const vector range.
 
template<class vec_t >
const const_vector_range_gen< vec_t > const_vector_range (const const_vector_range_gen< vec_t > &v, size_t start, size_t last)
 Recursively create a const o2scl::vector_range_gen object from a const vector range.
 
template<class dat_t >
std::vector< dat_t > vector_range_copy (const std::vector< dat_t > &v, size_t start, size_t last)
 Vector range function template for std::vector More...
 
template<class dat_t >
const std::vector< dat_t > vector_range_copy (const std::vector< dat_t > &v, size_t start, size_t last)
 Const vector range function template for std::vector More...
 
Armadillo specializations
double matrix_max (const arma::mat &data)
 Armadillo version of matrix_max()
 
double matrix_min (const arma::mat &data)
 Armadillo version of matrix_min()
 
template<>
arma::subview_row< double > matrix_row< arma::mat, arma::subview_row< double > > (arma::mat &M, size_t row)
 Armadillo version of matrix_row()
 
template<>
arma::subview_col< double > matrix_column< arma::mat, arma::subview_col< double > > (arma::mat &M, size_t column)
 Armadillo version of matrix_column()
 
Eigen specializations
double matrix_max (const Eigen::MatrixXd &data)
 Eigen version of matrix_max()
 
double matrix_min (const Eigen::MatrixXd &data)
 Eigen version of matrix_min()
 
template<>
Eigen::MatrixXd::RowXpr matrix_row< Eigen::MatrixXd, Eigen::MatrixXd::RowXpr > (Eigen::MatrixXd &M, size_t row)
 Eigen version of matrix_row()
 
template<>
Eigen::MatrixXd::ColXpr matrix_column< Eigen::MatrixXd, Eigen::MatrixXd::ColXpr > (Eigen::MatrixXd &M, size_t column)
 Eigen version of matrix_column()
 
Compute the derivative at every point of a generic vector

Given a vector v of size n, these functions compute the derivative at every point and store the result in dv.

template<class vec_t , class vec2_t >
void vector_deriv_threept (size_t n, vec_t &v, vec2_t &dv)
 Derivative of a vector with a three-point formula.
 
template<class vec_t , class vec2_t >
void vector_deriv_threept_tap (size_t n, vec_t &v, vec2_t &dv)
 Derivative of a vector with a three-point formula using two-point at the edges.
 
template<class vec_t , class vec2_t >
void vector_deriv_fivept (size_t n, vec_t &v, vec2_t &dv)
 Derivative of a vector with a five-point formula.
 
template<class vec_t , class vec2_t >
void vector_deriv_fivept_tap (size_t n, vec_t &v, vec2_t &dv)
 Derivative of a vector with a five-point formula with four- and three-point formulas used at the edges.
 
template<class ovec_t , class vec2_t >
void vector_deriv_interp (size_t n, ovec_t &v, vec2_t &dv, size_t interp_type=itp_cspline)
 Derivative from interpolation object.
 
template<class vec_t , class vec2_t , class vec3_t >
void vector_deriv_interp (size_t n, vec_t &vx, vec2_t &vy, vec3_t &dv, size_t interp_type=itp_cspline)
 Derivative from interpolation object.
 
Compute the integral over a generic vector

These functions implement composite (sometimes called extended) Newton-Cotes rules.

Given a vector v of size n, these functions compute the integral over the entire vector and return the result.

These functions were principally based on the information at http://mathworld.wolfram.com/Newton-CotesFormulas.html .

template<class vec_t >
double vector_integ_trap (size_t n, vec_t &v)
 Integrate with an extended trapezoidal rule.
 
template<class vec_t >
double vector_integ_threept (size_t n, vec_t &v)
 Integrate with an extended 3-point rule (extended Simpson's rule) More...
 
template<class vec_t >
double vector_integ_extended4 (size_t n, vec_t &v)
 Integrate with an extended rule for 4 or more points. More...
 
template<class vec_t >
double vector_integ_durand (size_t n, vec_t &v)
 Integrate with Durand's rule for 4 or more points. More...
 
template<class vec_t >
double vector_integ_extended8 (size_t n, vec_t &v)
 Integrate with an extended rule for 8 or more points. More...
 
template<class ovec_t >
double vector_integ_interp (size_t n, ovec_t &v, size_t interp_type)
 Integral from interpolation object.
 
Vector functions
template<class vec_t >
double vector_mean (size_t n, const vec_t &data)
 Compute the mean of the first n elements of a vector. More...
 
template<class vec_t >
double vector_mean (const vec_t &data)
 Compute the mean of all of the vector elements. More...
 
template<class vec_t >
double vector_variance_fmean (size_t n, const vec_t &data, double mean)
 Compute variance with specified mean known in advance. More...
 
template<class vec_t >
double vector_variance_fmean (const vec_t &data, double mean)
 Compute variance with specified mean known in advance. More...
 
template<class vec_t >
double vector_variance (size_t n, const vec_t &data, double mean)
 Compute the variance with specified mean. More...
 
template<class vec_t >
double vector_variance (const vec_t &data, double mean)
 Compute the variance with specified mean. More...
 
template<class vec_t >
double vector_variance (size_t n, const vec_t &data)
 Compute the variance. More...
 
template<class vec_t >
double vector_variance (const vec_t &data)
 Compute the variance. More...
 
template<class vec_t >
double vector_stddev_fmean (size_t n, const vec_t &data, double mean)
 Standard deviation with specified mean known in advance. More...
 
template<class vec_t >
double vector_stddev_fmean (const vec_t &data, double mean)
 Standard deviation with specified mean known in advance. More...
 
template<class vec_t >
double vector_stddev (size_t n, const vec_t &data)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double vector_stddev (const vec_t &data)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double vector_stddev (size_t n, const vec_t &data, double mean)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double vector_stddev (const vec_t &data, double mean)
 Standard deviation with specified mean. More...
 
template<class vec_t >
double vector_absdev (size_t n, const vec_t &data, double mean)
 Absolute deviation from the specified mean. More...
 
template<class vec_t >
double vector_absdev (const vec_t &data, double mean)
 Absolute deviation from the specified mean. More...
 
template<class vec_t >
double vector_absdev (size_t n, const vec_t &data)
 Absolute deviation from the computed mean. More...
 
template<class vec_t >
double vector_absdev (const vec_t &data)
 Absolute deviation from the computed mean. More...
 
template<class vec_t >
double vector_skew (size_t n, const vec_t &data, double mean, double stddev)
 Skewness with specified mean and standard deviation. More...
 
template<class vec_t >
double vector_skew (const vec_t &data, double mean, double stddev)
 Skewness with specified mean and standard deviation. More...
 
template<class vec_t >
double vector_skew (size_t n, const vec_t &data)
 Skewness with computed mean and standard deviation. More...
 
template<class vec_t >
double vector_skew (const vec_t &data)
 Skewness with computed mean and standard deviation. More...
 
template<class vec_t >
double vector_kurtosis (size_t n, const vec_t &data, double mean, double stddev)
 Kurtosis with specified mean and standard deviation. More...
 
template<class vec_t >
double vector_kurtosis (const vec_t &data, double mean, double stddev)
 Kurtosis with specified mean and standard deviation. More...
 
template<class vec_t >
double vector_kurtosis (size_t n, const vec_t &data)
 Kurtosis with computed mean and standard deviation. More...
 
template<class vec_t >
double vector_kurtosis (const vec_t &data)
 Kurtosis with computed mean and standard deviation. More...
 
template<class vec_t >
double vector_lag1_autocorr (size_t n, const vec_t &data, double mean)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double vector_lag1_autocorr (const vec_t &data, double mean)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double vector_lag1_autocorr (size_t n, const vec_t &data)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double vector_lag1_autocorr (const vec_t &data)
 Lag-1 autocorrelation. More...
 
template<class vec_t >
double vector_lagk_autocorr (size_t n, const vec_t &data, size_t k, double mean)
 Lag-k autocorrelation. More...
 
template<class vec_t >
double vector_lagk_autocorr (const vec_t &data, size_t k, double mean)
 Lag-k autocorrelation. More...
 
template<class vec_t >
double vector_lagk_autocorr (size_t n, const vec_t &data, size_t k)
 Lag-k autocorrelation. More...
 
template<class vec_t >
double vector_lagk_autocorr (const vec_t &data, size_t k)
 Lag-k autocorrelation. More...
 
template<class vec_t , class vec2_t >
double vector_covariance (size_t n, const vec_t &data1, const vec2_t &data2, double mean1, double mean2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double vector_covariance (const vec_t &data1, const vec2_t &data2, double mean1, double mean2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double vector_covariance (size_t n, const vec_t &data1, const vec2_t &data2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double vector_covariance (const vec_t &data1, const vec2_t &data2)
 Compute the covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double vector_correlation (size_t n, const vec_t &data1, const vec2_t &data2)
 Pearson's correlation. More...
 
template<class vec_t , class vec2_t >
double vector_correlation (const vec_t &data1, const vec2_t &data2)
 Pearson's correlation. More...
 
template<class vec_t , class vec2_t >
double vector_pvariance (size_t n1, const vec_t &data1, size_t n2, const vec2_t &data2)
 The pooled variance of two vectors. More...
 
template<class vec_t , class vec2_t >
double vector_pvariance (const vec_t &data1, const vec2_t &data2)
 The pooled variance of two vectors. More...
 
template<class vec_t >
double vector_quantile_sorted (size_t n, const vec_t &data, const double f)
 Quantile from sorted data (ascending only) More...
 
template<class vec_t >
double vector_quantile_sorted (const vec_t &data, const double f)
 Quantile from sorted data (ascending only) More...
 
template<class vec_t >
double vector_median_sorted (size_t n, const vec_t &data)
 Return the median of sorted (ascending or descending) data. More...
 
template<class vec_t >
double vector_median_sorted (const vec_t &data)
 Return the median of sorted (ascending or descending) data. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double vector_chi_squared (size_t n, const vec_t &obs, const vec2_t &exp, const vec3_t &err)
 Compute the chi-squared statistic. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double vector_chi_squared (const vec_t &obs, const vec2_t &exp, const vec3_t &err)
 Compute the chi-squared statistic. More...
 
Weighted vector functions
template<class vec_t , class vec2_t >
double wvector_mean (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the mean of weighted data. More...
 
template<class vec_t , class vec2_t >
double wvector_mean (const vec_t &data, const vec2_t &weights)
 Compute the mean of weighted data. More...
 
template<class vec_t >
double wvector_factor (size_t n, const vec_t &weights)
 Compute a normalization factor for weighted data. More...
 
template<class vec_t >
double wvector_factor (const vec_t &weights)
 Compute a normalization factor for weighted data. More...
 
template<class vec_t , class vec2_t >
double wvector_variance_fmean (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double wvector_variance_fmean (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double wvector_variance (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_variance (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the variance of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_variance (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the variance of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t >
double wvector_variance (const vec_t &data, const vec2_t &weights)
 Compute the variance of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double wvector_covariance (size_t n, const vec_t &data1, const vec2_t &data2, const vec3_t &weights)
 The weighted covariance of two vectors. More...
 
template<class vec_t , class vec2_t , class vec3_t >
double wvector_covariance (const vec_t &data1, const vec2_t &data2, const vec3_t &weights)
 The weighted covariance of two vectors. More...
 
template<class vec_t , class vec2_t >
double wvector_stddev_fmean (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double wvector_stddev_fmean (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with a mean known in advance. More...
 
template<class vec_t , class vec2_t >
double wvector_stddev (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the standard deviation of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t >
double wvector_stddev (const vec_t &data, const vec2_t &weights)
 Compute the standard deviation of a weighted vector where mean is computed automatically. More...
 
template<class vec_t , class vec2_t >
double wvector_stddev (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_stddev (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the standard deviation of a weighted vector with specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_sumsq (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the weighted sum of squares of data about the specified weighted mean. More...
 
template<class vec_t , class vec2_t >
double wvector_sumsq (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the weighted sum of squares of data about the specified weighted mean. More...
 
template<class vec_t , class vec2_t >
double wvector_sumsq (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the weighted sum of squares of data about the weighted mean. More...
 
template<class vec_t , class vec2_t >
double wvector_sumsq (const vec_t &data, const vec2_t &weights)
 Compute the weighted sum of squares of data about the weighted mean. More...
 
template<class vec_t , class vec2_t >
double wvector_absdev (size_t n, const vec_t &data, const vec2_t &weights, double wmean)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_absdev (const vec_t &data, const vec2_t &weights, double wmean)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_absdev (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_absdev (const vec_t &data, const vec2_t &weights)
 Compute the absolute deviation of data about a specified mean. More...
 
template<class vec_t , class vec2_t >
double wvector_skew (size_t n, const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double wvector_skew (const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double wvector_skew (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double wvector_skew (const vec_t &data, const vec2_t &weights)
 Compute the skewness of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double wvector_kurtosis (size_t n, const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double wvector_kurtosis (const vec_t &data, const vec2_t &weights, double wmean, double wsd)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double wvector_kurtosis (size_t n, const vec_t &data, const vec2_t &weights)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 
template<class vec_t , class vec2_t >
double wvector_kurtosis (const vec_t &data, const vec2_t &weights)
 Compute the kurtosis of data with specified mean and standard deviation. More...
 

Variables

err_hnd_typeerr_hnd
 The global error handler pointer.
 
err_hnd_gsl alt_err_hnd
 An alternate GSL-like error handler.
 
err_hnd_cpp def_err_hnd
 The default error handler.
 
lib_settings_class o2scl_settings
 The global library settings object. More...
 

Detailed Description

Main namespace.

By default, all O2scl classes and functions which are not listed as being in one of O2scl 's smaller specialized namespaces are in this namespace.

This namespace documentation is in the file src/base/lib_settings.h

This file is documented in mcmc.h .

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The errors associated with the integers between -2 and 32 are based on GSL, the rest are specific to O2scl .

Enumerator
success 

Success.

gsl_failure 

Failure.

gsl_continue 

iteration has not converged

exc_edom 

input domain error, e.g sqrt(-1)

exc_erange 

output range error, e.g. exp(1e100)

exc_efault 

invalid pointer

exc_einval 

invalid argument supplied by user

exc_efailed 

generic failure

exc_efactor 

factorization failed

exc_esanity 

sanity check failed - shouldn't happen

exc_enomem 

malloc failed

exc_ebadfunc 

problem with user-supplied function

exc_erunaway 

iterative process is out of control

exc_emaxiter 

exceeded max number of iterations

exc_ezerodiv 

tried to divide by zero

exc_ebadtol 

user specified an invalid tolerance

exc_etol 

failed to reach the specified tolerance

exc_eundrflw 

underflow

exc_eovrflw 

overflow

exc_eloss 

loss of accuracy

exc_eround 

failed because of roundoff error

exc_ebadlen 

matrix, vector lengths are not conformant

exc_enotsqr 

matrix not square

exc_esing 

apparent singularity detected

exc_ediverge 

integral or series is divergent

exc_eunsup 

requested feature is not supported by the hardware

exc_eunimpl 

requested feature not (yet) implemented

exc_ecache 

cache limit exceeded

exc_etable 

table limit exceeded

exc_enoprog 

iteration is not making progress toward solution

exc_enoprogj 

jacobian evaluations are not improving the solution

exc_etolf 

cannot reach the specified tolerance in f

exc_etolx 

cannot reach the specified tolerance in x

exc_etolg 

cannot reach the specified tolerance in gradient

exc_eof 

end of file

exc_enotfound 

Generic "not found" result.

exc_ememtype 

Incorrect type for memory object.

exc_efilenotfound 

File not found.

exc_eindex 

Invalid index for array or matrix.

exc_outsidecons 

Outside constraint region.

Definition at line 45 of file err_hnd.h.

◆ anonymous enum

anonymous enum
Enumerator
itp_linear 

Linear.

itp_cspline 

Cubic spline for natural boundary conditions.

itp_cspline_peri 

Cubic spline for periodic boundary conditions.

itp_akima 

Akima spline for natural boundary conditions.

itp_akima_peri 

Akima spline for periodic boundary conditions.

itp_monotonic 

Monotonicity-preserving interpolation (unfinished)

itp_steffen 

Steffen's monotonic method.

Definition at line 68 of file interp.h.

Function Documentation

◆ array_2d_out()

template<class mat_t >
int o2scl::array_2d_out ( std::ostream &  os,
size_t  nrows,
size_t  ncols,
mat_t &  A 
)

The type mat_t can be any 2d-array type which allows individual element access using [size_t][size_t]

This outputs all of the matrix elements using output settings specified by os. The alignment performed by columnify using columnify::align_dp, i.e. the numbers are aligned by their decimal points. If the numbers have no decimal points, then the decimal point is assumed to be to the right of the last character in the string representation of the number.

This function outputs the matrix assuming the first index is the row index and the second index is the column index. For the opposite convention, use array_2d_trans_out().

Idea for Future:
If all of the matrix elements are positive integers and scientific mode is not set, then we can avoid printing the extra spaces.

Definition at line 418 of file columnify.h.

◆ array_2d_trans_out()

template<class mat_t >
int o2scl::array_2d_trans_out ( std::ostream &  os,
size_t  nrows,
size_t  ncols,
mat_t &  A 
)

The type mat_t can be any 2d-array type which allows individual element access using [size_t][size_t]

This outputs all of the matrix elements using output settings specified by os. The alignment performed by columnify using columnify::align_dp, i.e. the numbers are aligned by their decimal points. If the numbers have no decimal points, then the decimal point is assumed to be to the right of the last character in the string representation of the number.

Idea for Future:
If all of the matrix elements are positive integers and scientific mode is not set, then we can avoid printing the extra spaces.

This function outputs the matrix assuming the first index is the column index and the second index is the row index. For the opposite convention, use array_2d_out().

Definition at line 462 of file columnify.h.

◆ binary_to_hex()

std::string o2scl::binary_to_hex ( std::string  s)

This function proceeds from left to right, ignoring parts of the string that do not consist of squences of four '1's or '0's.

◆ btos()

std::string o2scl::btos ( bool  b)

This returns "1" for true and "0" for false.

◆ const_vector_range() [1/6]

template<class dat_t >
const dat_t* o2scl::const_vector_range ( const dat_t *  v,
size_t  start,
size_t  last 
)
Note
In this case, the return type is the same as the type of the first parameter.

Definition at line 2394 of file vector.h.

◆ const_vector_range() [2/6]

template<class dat_t >
const boost::numeric::ublas::vector_range<boost::numeric::ublas::vector<dat_t> > o2scl::const_vector_range ( boost::numeric::ublas::vector< dat_t > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is not the same as the type of the first parameter.

Definition at line 2427 of file vector.h.

◆ const_vector_range() [3/6]

template<class dat_t >
const boost::numeric::ublas::vector_range<const boost::numeric::ublas::vector<dat_t> > o2scl::const_vector_range ( const boost::numeric::ublas::vector< dat_t > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is not the same as the type of the first parameter.

Definition at line 2446 of file vector.h.

◆ const_vector_range() [4/6]

template<class dat_t >
const boost::numeric::ublas::vector_range<boost::numeric::ublas::vector_range <boost::numeric::ublas::vector<dat_t> > > o2scl::const_vector_range ( boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is not the same as the type of the first parameter.

Definition at line 2492 of file vector.h.

◆ const_vector_range() [5/6]

template<class dat_t >
const boost::numeric::ublas::vector_range<const boost::numeric::ublas::vector_range <boost::numeric::ublas::vector<dat_t> > > o2scl::const_vector_range ( const boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is not the same as the type of the first parameter.

Definition at line 2516 of file vector.h.

◆ const_vector_range() [6/6]

template<class dat_t >
const boost::numeric::ublas::vector_range<const boost::numeric::ublas::vector_range <const boost::numeric::ublas::vector<dat_t> > > o2scl::const_vector_range ( const boost::numeric::ublas::vector_range< const boost::numeric::ublas::vector< dat_t > > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is not the same as the type of the first parameter.

Definition at line 2540 of file vector.h.

◆ constraint()

double o2scl::constraint ( double  x,
double  center,
double  width,
double  height 
)
inline

Defining $ c= $ center, $ w= $ width, $ h= $ height, this returns the value $ h (1+|x-c-w|/w) $ if $ x>c+w $ and $ h (1+|x-c+w|/w) $ if $ x<c-w $ . The value near $ x=c-w $ or $ x=c+w $ is $ h $ (the value of the function exactly at these points is zero) and the value at $ x=c-2w $ or $ x=c+2w $ is $ 2 h $ .

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then a minimizer may ignore this constraint.

Definition at line 358 of file min.h.

◆ cont_constraint()

double o2scl::cont_constraint ( double  x,
double  center,
double  width,
double  height,
double  tightness = 40.0,
double  exp_arg_limit = 50.0 
)
inline

Defining $ c= $ center, $ w= $ width, $ h= $ height, $ t= $ tightness, and $ \ell= $ exp_arg_limit, this returns the value

\[ h \left(\frac{x-c}{w}\right)^2 \left[ 1+ e^{t\left(x-c+w\right)\left(c+w-x\right)/w^2} \right]^{-1} \]

This function is continuous and differentiable. Note that if $ x=c $ , then the function returns zero.

The exponential is handled gracefully by assuming that anything smaller than $ \exp(-\ell) $ is zero. This creates a small discontinuity which can be removed with the sufficiently large value of $ \ell $.

It is important to note that, for large distances of x from center, this scales quadratically. If you are trying to constrain a function which decreases faster than quadratically by making x far from center, then a minimizer may ignore this constraint.

In the limit $ t \rightarrow \infty $, this function converges towards the squared value of constraint(), except exactly at the points $ x=c-w $ and $ x=c+w $.

Definition at line 399 of file min.h.

◆ cont_lower_bound()

double o2scl::cont_lower_bound ( double  x,
double  center,
double  width,
double  height,
double  tightness = 40.0,
double  exp_arg_limit = 50.0 
)
inline

Defining $ c= $ center, $ w= $ width, $ h= $ height, $ t= $ tightness, and $ \ell= $ exp_arg_limit, this returns $ h(c-x+w)/(w+w\exp(t(x-c)/w)) $ and has the advantage of being a continuous and differentiable function. The value of the function exactly at $ x=c $ is $ h/2 $, but for $ x $ just below $ c $ the function is $ h $ and just above $ c $ the function is quite small.

The exponential is handled gracefully by assuming that anything smaller than $ \exp(-\ell) $ is zero. This creates a small discontinuity which can be removed with the sufficiently large value of $ \ell $.

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then a minimizer may ingore this constraint.

In the limit $ t \rightarrow \infty $, this function converges towards lower_bound(), except exactly at the point $ x=c $.

Definition at line 460 of file min.h.

◆ count_words()

size_t o2scl::count_words ( std::string  str)

Words are defined as groups of characters separated by whitespace, where whitespace is any combination of adjacent spaces, tabs, carriage returns, etc. On most systems, whitespace is usually defined as any character corresponding to the integers 9 (horizontal tab), 10 (line feed), 11 (vertical tab), 12 (form feed), 13 (carriage return), and 32 (space bar). The test program misc_ts enumerates the characters between 0 and 255 (inclusive) that count as whitespace for this purpose.

Idea for Future:
Make consistent with split_string().

◆ dtos()

std::string o2scl::dtos ( double  x,
int  prec = 6,
bool  auto_prec = false 
)

If auto_prec is false, then the number is converted to a string in the ios::scientific mode, otherwise, neither the scientific or fixed mode flags are set and the number is converted to a string in "automatic" mode.

◆ error_update()

void o2scl::error_update ( int &  ret,
int  err 
)
inline

If ret is zero, this sets ret to the value err, and if ret is nonzero this function does nothing.

Definition at line 319 of file err_hnd.h.

◆ fermi_function()

double o2scl::fermi_function ( double  E,
double  mu,
double  T,
double  limit = 40.0 
)

$ \left[1+\exp\left(E/T-\mu/T\right)\right]^{-1} $

This calculates a Fermi-Dirac distribution function guaranteeing that numbers larger than $ \exp(\mathrm{limit}) $ and smaller than $ \exp(-\mathrm{limit}) $ will be avoided. The default value of limit=40 ensures accuracy to within 1 part in $ 10^{17} $ compared to the maximum of the distribution (which is unity).

Note that this function may return Inf or NAN if limit is too large, depending on the machine precision.

◆ function_to_double()

double o2scl::function_to_double ( std::string  s,
bool  err_on_fail = true 
)

This uses o2scl::calculator to convert strings like "-1.0e-3", "1.0/3.0" and "exp(cos(-1.0e-2))" to floating point numbers.

◆ has_minus_sign()

bool o2scl::has_minus_sign ( double *  x)

This function returns true if the number pointed to by x has a minus sign using the GSL IEEE functions. It is useful, for example, in distinguishing "-0.0" from "+0.0".

◆ HSVtoRGB()

void o2scl::HSVtoRGB ( double  h,
double  s,
double  v,
double &  r,
double &  g,
double &  b 
)

Taken from Nathan Schaller's webpage at http://www.cs.rit.edu/~ncs/color/t_convert.html

The inputs should be in the ranges $ h \in [0,360] $, $ s \in [0,1] $, and $ v \in [0,1] $. The output values r, g, and b are $ \in [0,1] $.

If s == 0, then h = -1 (undefined)

◆ is_number()

bool o2scl::is_number ( std::string  s)
Note
The test employed is not exhaustive and this function may return true for some numbers and may return false for some non-numbers.

◆ lower_bound()

double o2scl::lower_bound ( double  x,
double  center,
double  width,
double  height 
)
inline

Defining $ c= $ center, $ w= $ width, $ h= $ height, this returns $ h(1+|x-c|/w) $ if $ x<c $ and zero otherwise. The value at $ x=c $ is $ h $ , while the value at $ x=c-w $ is $ 2 h $ .

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then a minimizer may ignore this constraint.

Definition at line 426 of file min.h.

◆ matrix_column()

template<class mat_t , class mat_column_t >
mat_column_t o2scl::matrix_column ( mat_t &  M,
size_t  column 
)

This class template works with combinations of ublas matrix and matrix_column objects, arma::mat and arma::colvec, and Eigen::MatrixXd and Eigen::VectorXd.

Note
When calling this function with ublas objects, the namespace prefix "o2scl::" must often be specified, otherwise some compilers will use argument dependent lookup and get (justifiably) confused with matrix_column in the ublas namespace.
The template parameters must be explicitly specified when calling this template function.

Definition at line 2277 of file vector.h.

◆ matrix_copy() [1/2]

template<class mat_t , class mat2_t >
void o2scl::matrix_copy ( mat_t &  src,
mat2_t &  dest 
)

Copy src to dest, resizing dest if it is too small.

This function will work for any classes mat_t and mat2_t which have suitably defined operator(), size(), and resize() methods.

Definition at line 179 of file vector.h.

◆ matrix_copy() [2/2]

template<class mat_t , class mat2_t >
void o2scl::matrix_copy ( size_t  M,
size_t  N,
mat_t &  src,
mat2_t &  dest 
)

Copy the first (M,N) elements of src to dest. It is assumed that the memory allocation for dest has already been performed.

This function will work for any class vec2_t which has an operator[][] which returns a reference to the corresponding element and class vec_t with an operator[][] which returns either a reference or the value of the corresponding element.

Definition at line 204 of file vector.h.

◆ matrix_lookup() [1/2]

template<class mat_t >
void o2scl::matrix_lookup ( size_t  m,
size_t  n,
const mat_t &  A,
double  x0,
size_t &  i,
size_t &  j 
)

Return the location (i,j) of the element closest to x0.

Definition at line 1784 of file vector.h.

◆ matrix_lookup() [2/2]

template<class mat_t >
void o2scl::matrix_lookup ( const mat_t &  A,
double  x0,
size_t &  i,
size_t &  j 
)

Return the location (i,j) of the element closest to x0.

Definition at line 1823 of file vector.h.

◆ matrix_out() [1/2]

template<class mat_t >
int o2scl::matrix_out ( std::ostream &  os,
size_t  nrows,
size_t  ncols,
mat_t &  A 
)

The type mat_t can be any matrix type which allows individual element access using operator()(size_t,size_t).

This outputs all of the matrix elements using output settings specified by os. The alignment performed by columnify using columnify::align_dp, i.e. the numbers are aligned by their decimal points. If the numbers have no decimal points, then the decimal point is assumed to be to the right of the last character in the string representation of the number.

This function outputs the matrix assuming the first index is the row index and the second index is the column index. For the opposite convention, use matrix_trans_out().

Definition at line 254 of file columnify.h.

◆ matrix_out() [2/2]

template<class mat_t >
int o2scl::matrix_out ( std::ostream &  os,
mat_t &  A 
)

The type mat_t can be any matrix type which allows individual element access using operator()(size_t,size_t) and access to the number of columns and rows using A.size1() and A.size2().

This outputs all of the matrix elements using output settings specified by os. The alignment performed by columnify using columnify::align_dp, i.e. the numbers are aligned by their decimal points. If the numbers have no decimal points, then the decimal point is assumed to be to the right of the last character in the string representation of the number.

This function outputs the matrix assuming the first index is the row index and the second index is the column index. For the opposite convention, use matrix_trans_out().

Definition at line 294 of file columnify.h.

◆ matrix_row()

template<class mat_t , class mat_row_t >
mat_row_t o2scl::matrix_row ( mat_t &  M,
size_t  row 
)

This class template works with combinations of ublas matrix and matrix_row objects, arma::mat and arma::rowvec, and Eigen::MatrixXd and Eigen::VectorXd.

Note
When calling this function with ublas objects, the namespace prefix "o2scl::" must often be specified, otherwise some compilers will use argument dependent lookup and get (justifiably) confused with matrix_row in the ublas namespace.
The template parameters must be explicitly specified when calling this template function.

Definition at line 2221 of file vector.h.

◆ matrix_swap() [1/2]

template<class mat_t , class mat2_t , class data_t >
void o2scl::matrix_swap ( size_t  M,
size_t  N,
mat_t &  v1,
mat2_t &  v2 
)

This function swaps the elements of v1 and v2, one element at a time.

Definition at line 545 of file vector.h.

◆ matrix_swap() [2/2]

template<class mat_t , class data_t >
void o2scl::matrix_swap ( mat_t &  m,
size_t  i1,
size_t  j1,
size_t  i2,
size_t  j2 
)

This function swaps the element (i1,j1) and element (i2,j2) of matrix m1.

Definition at line 574 of file vector.h.

◆ matrix_swap_cols()

template<class mat_t , class data_t >
void o2scl::matrix_swap_cols ( size_t  M,
mat_t &  m,
size_t  j1,
size_t  j2 
)

This function swaps the element (i1,j1) and element (i2,j2) of matrix m1.

Definition at line 598 of file vector.h.

◆ matrix_swap_cols_double()

template<class mat_t >
void o2scl::matrix_swap_cols_double ( size_t  M,
mat_t &  m,
size_t  j1,
size_t  j2 
)

This function swaps the element i and element j of matrix v1.

Definition at line 615 of file vector.h.

◆ matrix_swap_double() [1/2]

template<class mat_t , class mat2_t , class data_t >
void o2scl::matrix_swap_double ( size_t  M,
size_t  N,
mat_t &  m1,
mat2_t &  m2 
)

This function swaps the elements of m1 and m2, one element at a time.

Definition at line 564 of file vector.h.

◆ matrix_swap_double() [2/2]

template<class mat_t >
void o2scl::matrix_swap_double ( mat_t &  m,
size_t  i1,
size_t  j1,
size_t  i2,
size_t  j2 
)

This function swaps the element i and element j of matrix v1.

Definition at line 587 of file vector.h.

◆ matrix_swap_rows()

template<class mat_t , class data_t >
void o2scl::matrix_swap_rows ( size_t  N,
mat_t &  m,
size_t  i1,
size_t  i2 
)

This function swaps the element (i1,j1) and element (i2,j2) of matrix m1.

Definition at line 626 of file vector.h.

◆ matrix_swap_rows_double()

template<class mat_t >
void o2scl::matrix_swap_rows_double ( size_t  N,
mat_t &  m,
size_t  i1,
size_t  i2 
)

This function swaps the element i and element j of matrix v1.

Definition at line 643 of file vector.h.

◆ matrix_trans_out() [1/2]

template<class mat_t >
int o2scl::matrix_trans_out ( std::ostream &  os,
size_t  nrows,
size_t  ncols,
mat_t &  A 
)

The type mat_t can be any matrix type which allows individual element access using operator()(size_t,size_t).

This outputs all of the matrix elements using output settings specified by os. The alignment performed by columnify using columnify::align_dp, i.e. the numbers are aligned by their decimal points. If the numbers have no decimal points, then the decimal point is assumed to be to the right of the last character in the string representation of the number.

This function outputs the matrix assuming the first index is the column index and the second index is the row index. For the opposite convention, use matrix_out().

Definition at line 334 of file columnify.h.

◆ matrix_trans_out() [2/2]

template<class mat_t >
int o2scl::matrix_trans_out ( std::ostream &  os,
mat_t &  A 
)

The type mat_t can be any matrix type which allows individual element access using operator()(size_t,size_t) and access to the number of columns and rows using A.size1() and A.size2().

This outputs all of the matrix elements using output settings specified by os. The alignment performed by columnify using columnify::align_dp, i.e. the numbers are aligned by their decimal points. If the numbers have no decimal points, then the decimal point is assumed to be to the right of the last character in the string representation of the number.

This function outputs the matrix assuming the first index is the column index and the second index is the row index. For the opposite convention, use matrix_out().

Definition at line 374 of file columnify.h.

◆ matrix_transpose() [1/4]

template<class mat_t , class mat2_t >
void o2scl::matrix_transpose ( mat_t &  src,
mat2_t &  dest 
)

Copy the transpose of src to dest, resizing dest if it is too small.

This function will work for any classes mat_t and mat2_t which have suitably defined operator(), size(), and resize() methods.

Definition at line 225 of file vector.h.

◆ matrix_transpose() [2/4]

template<class mat_t , class mat2_t >
void o2scl::matrix_transpose ( size_t  m,
size_t  n,
mat_t &  src,
mat2_t &  dest 
)

Copy the transpose of the first m rows and the first cols of the matrix src into the matrix dest

This function will work for any classes mat_t and mat2_t which has a suitably defined operator() method.

Definition at line 246 of file vector.h.

◆ matrix_transpose() [3/4]

template<class mat_t , class data_t >
void o2scl::matrix_transpose ( mat_t &  src)

Transpose the matrix src . If the matrix is not square, only the upper-left square part of the matrix will be transposed.

This function will work for any classes mat_t and mat2_t which have suitably defined operator(), size(), and resize() methods.

Definition at line 265 of file vector.h.

◆ matrix_transpose() [4/4]

template<class mat_t , class data_t >
void o2scl::matrix_transpose ( size_t  m,
size_t  n,
mat_t &  src 
)

Copy the transpose of the first m rows and the first cols of the matrix src into the matrix dest

This function will work for any classes mat_t and mat2_t which has a suitably defined operator() method.

Definition at line 290 of file vector.h.

◆ operator<<()

std::ostream& o2scl::operator<< ( std::ostream &  os,
const permutation p 
)

A space is output between the permutation elements but no space or endline character is output after the last element.

If the size is zero, this function outputs nothing and does not call the error handler.

◆ pipe_cmd_string() [1/2]

int o2scl::pipe_cmd_string ( std::string  cmd,
std::string &  result,
bool  err_on_fail = true,
int  nmax = 80 
)
Note
This function uses popen() and may not work properly on some systems. If HAVE_POPEN was not defined during O2scl's compilation, then this function will throw an exception (or if err_on_fail is false, it will return a nonzero value).
The result string may contain a carriage return at the end.

◆ pipe_cmd_string() [2/2]

std::string o2scl::pipe_cmd_string ( std::string  cmd,
int  nmax = 80 
)

This function always throws exceptions if it fails.

Note
The result string may contain a carriage return at the end.

◆ ptos()

std::string o2scl::ptos ( void *  p)

This uses an ostringstream to convert a pointer to a string and is architecture-dependent.

◆ quadratic_extremum_coeffs()

template<class data_t >
void o2scl::quadratic_extremum_coeffs ( const data_t  x1,
const data_t  x2,
const data_t  x3,
const data_t  y1,
const data_t  y2,
const data_t  y3,
data_t &  a,
data_t &  b,
data_t &  c 
)

This function should work for any floating-point data type, but will suffer from problems due to lack of precision in some cases.

Definition at line 478 of file misc.h.

◆ quadratic_extremum_x()

template<class data_t >
data_t o2scl::quadratic_extremum_x ( const data_t  x1,
const data_t  x2,
const data_t  x3,
const data_t  y1,
const data_t  y2,
const data_t  y3 
)

This function should work for any floating-point data type, but will suffer from problems due to lack of precision in some cases.

Definition at line 323 of file misc.h.

◆ quadratic_extremum_xy()

template<class data_t >
void o2scl::quadratic_extremum_xy ( const data_t  x1,
const data_t  x2,
const data_t  x3,
const data_t  y1,
const data_t  y2,
const data_t  y3,
data_t &  x,
data_t &  y 
)

This function should work for any floating-point data type, but will suffer from problems due to lack of precision in some cases.

Definition at line 444 of file misc.h.

◆ quadratic_extremum_y()

template<class data_t >
data_t o2scl::quadratic_extremum_y ( const data_t  x1,
const data_t  x2,
const data_t  x3,
const data_t  y1,
const data_t  y2,
const data_t  y3 
)

This function should work for any floating-point data type, but will suffer from problems due to lack of precision in some cases.

Definition at line 414 of file misc.h.

◆ quadratic_extremum_y_full()

template<class data_t >
void o2scl::quadratic_extremum_y_full ( const data_t  x1,
const data_t  x2,
const data_t  x3,
const data_t  y1,
const data_t  y2,
const data_t  y3,
const data_t &  xmin,
const data_t &  ymin,
const data_t &  a,
const data_t &  b,
const data_t &  c,
const data_t &  den 
)

This function provides the three coefficients of the quadratic, a, b, and c, and the denominator den.

This function should work for any floating-point data type, but will suffer from problems due to lack of precision in some cases.

Definition at line 380 of file misc.h.

◆ remove_whitespace()

void o2scl::remove_whitespace ( std::string &  s)

This function removes all characters in s which correspond to the integer values 9, 10, 11, 12, 13, or 32.

◆ RGBtoHSV()

void o2scl::RGBtoHSV ( double  r,
double  g,
double  b,
double &  h,
double &  s,
double &  v 
)

Taken from Nathan Schaller's webpage at http://www.cs.rit.edu/~ncs/color/t_convert.html

The inputs should be in the ranges $ h \in [0,360] $, $ s \in [0,1] $, and $ v \in [0,1] $. The output values r, g, and b are $ \in [0,1] $.

If s == 0, then h = -1 (undefined)

◆ screenify()

template<class string_arr_t >
void o2scl::screenify ( size_t  nin,
const string_arr_t &  in_cols,
std::vector< std::string > &  out_cols,
size_t  max_size = 80 
)

Given a string array in_cols of size nin, screenify() reformats the array into columns creating a new string array out_cols.

For example, for an array of 10 strings

test1
test_of_string2
test_of_string3
test_of_string4
test5
test_of_string6
test_of_string7
test_of_string8
test_of_string9
test_of_string10

screenify() will create an array of 3 new strings:

test1            test_of_string4  test_of_string7  test_of_string10
test_of_string2  test5            test_of_string8
test_of_string3  test_of_string6  test_of_string9

If the value of max_size is less than the length of the longest input string (plus one for a space character), then the output strings may have a larger length than max_size.

Definition at line 124 of file misc.h.

◆ size_of_exponent()

size_t o2scl::size_of_exponent ( double  x)

This returns 2 or 3, depending on whether or not the absolute magnitude of the exponent is greater than or equal to 100. It uses stringstream to convert the number to a string and counts the number of characters directly.

◆ split_string()

void o2scl::split_string ( std::string  str,
std::vector< std::string > &  sv 
)

This function separates a string into words, and handles words that begin with a "</tt> by adding more words until finding one which ends with another <tt>". Strings like

this is a test

get parsed as "this", "is", "a", "test" and strings like

"this is" a test

get parsed as "this is", "a", "test".

This is used to reformat command descriptions and help text for the screen width in cli::comm_option_help(), to process lines read from a file in cli::comm_option_run(), and to process input in cli::run_interactive().

Idea for Future:
Add user-specified delimiters?

◆ stob()

bool o2scl::stob ( std::string  s,
bool  err_on_fail = true 
)

This returns true if only if the string has at least one character and the first non-whitespace character is either t, T, or one of the numbers 1 through 9.

If err_on_fail is true and the conversion fails, this function calls the error handler, otherwise this function just returns false.

◆ stod()

double o2scl::stod ( std::string  s,
bool  err_on_fail = true 
)

If err_on_fail is true and the conversion fails, this function calls the error handler, otherwise this function just returns 0.0.

If O2scl is compiled with C++11 support, this function is just a wrapper for std::stod.

Warning
Because of the presence of std::stod() in C++11, you may have to explicitly provide the namespace, i.e. o2scl::stod() in your code.

◆ stoi()

int o2scl::stoi ( std::string  s,
bool  err_on_fail = true 
)

If err_on_fail is true and the conversion fails, this function calls the error handler, otherwise this function just returns zero.

If O2scl is compiled with C++11 support, this function is just a wrapper for std::stoi.

Warning
Because of the presence of std::stoi() in C++11, you may have to explicitly provide the namespace, i.e. o2scl::stoi() in your code.

◆ stoszt()

size_t o2scl::stoszt ( std::string  s,
bool  err_on_fail = true 
)

If err_on_fail is true and the conversion fails, this function calls the error handler, otherwise this function just returns zero.

◆ vector_absdev() [1/4]

template<class vec_t >
double o2scl::vector_absdev ( size_t  n,
const vec_t &  data,
double  mean 
)

This function computes

\[ \sum_i | x_i - \mu | \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_absdev_m().

If n is zero, this function will return zero without calling the error handler.

Definition at line 340 of file vec_stats.h.

◆ vector_absdev() [2/4]

template<class vec_t >
double o2scl::vector_absdev ( const vec_t &  data,
double  mean 
)

This function computes

\[ \sum_i | x_i - \mu | \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_absdev_m().

If n is zero, this function will return zero without calling the error handler.

Definition at line 366 of file vec_stats.h.

◆ vector_absdev() [3/4]

template<class vec_t >
double o2scl::vector_absdev ( size_t  n,
const vec_t &  data 
)

This function computes

\[ \sum_i | x_i - \mu | \]

where the value of $ \mu $ is mean as computed from vector_mean().

This function produces the same results as gsl_stats_absdev().

If n is zero, this function will return zero without calling the error handler.

Definition at line 387 of file vec_stats.h.

◆ vector_absdev() [4/4]

template<class vec_t >
double o2scl::vector_absdev ( const vec_t &  data)

This function computes

\[ \sum_i | x_i - \mu | \]

where the value of $ \mu $ is mean as computed from vector_mean().

This function produces the same results as gsl_stats_absdev().

If n is zero, this function will return zero without calling the error handler.

Definition at line 408 of file vec_stats.h.

◆ vector_bsearch() [1/2]

template<class vec_t , class data_t >
size_t o2scl::vector_bsearch ( const data_t  x0,
const vec_t &  x,
size_t  lo,
size_t  hi 
)

This wrapper just calls o2scl::vector_bsearch_inc() or o2scl::vector_bsearch_dec() depending on the ordering of x.

Definition at line 1934 of file vector.h.

◆ vector_bsearch() [2/2]

template<class vec_t , class data_t >
size_t o2scl::vector_bsearch ( const data_t  x0,
const vec_t &  x 
)

This function calls o2scl::vector_bsearch_inc() or o2scl::vector_bsearch_dec() depending on the ordering of x.

Definition at line 1950 of file vector.h.

◆ vector_bsearch_dec()

template<class vec_t , class data_t >
size_t o2scl::vector_bsearch_dec ( const data_t  x0,
const vec_t &  x,
size_t  lo,
size_t  hi 
)

This function performs a binary search of between x[lo] and x[hi] (inclusive). It returns

  • lo if x0 > x[lo]
  • i if x[i] >= x0 > x[i+1] for lo <= i < hi
  • hi-1 if x0 <= x[hi-1]

The element at x[hi] is never referenced by this function. The parameter hi can be either the index of the last element (e.g. n-1 for a vector of size n with starting index 0), or the index of one element (e.g. n for a vector of size n and a starting index 0) for a depending on whether or not the user wants to allow the function to return the index of the last element.

The operation of this function is undefined if the data is not strictly monotonic, i.e. if some of the data elements are equal.

This function will call the error handler if lo is greater than hi.

Definition at line 1908 of file vector.h.

◆ vector_bsearch_inc()

template<class vec_t , class data_t >
size_t o2scl::vector_bsearch_inc ( const data_t  x0,
const vec_t &  x,
size_t  lo,
size_t  hi 
)

This function performs a binary search of between x[lo] and x[hi]. It returns

  • lo if x0 < x[lo]
  • i if x[i] <= x0 < x[i+2] for lo <= i < hi
  • hi-1 if x0 >= x[hi-1]

This function is designed to find the interval containing x0, not the index of the element closest to x0. To perform the latter operation, you can use vector_lookup().

The element at x[hi] is never referenced by this function. The parameter hi can be either the index of the last element (e.g. n-1 for a vector of size n with starting index 0), or the index of one element (e.g. n for a vector of size n and a starting index 0) for a depending on whether or not the user wants to allow the function to return the index of the last element.

This function operates in the same way as gsl_interp_bsearch().

The operation of this function is undefined if the data is not strictly monotonic, i.e. if some of the data elements are equal.

This function will call the error handler if lo is greater than hi.

Definition at line 1863 of file vector.h.

◆ vector_chi_squared() [1/2]

template<class vec_t , class vec2_t , class vec3_t >
double o2scl::vector_chi_squared ( size_t  n,
const vec_t &  obs,
const vec2_t &  exp,
const vec3_t &  err 
)

This function computes

\[ \sum_i \left( \frac{\mathrm{obs}_i - \mathrm{exp}_i} {\mathrm{err}_i}\right)^2 \]

where $ \mathrm{obs} $ are the observed values, $ \mathrm{exp} $ are the expected values, and $ \mathrm{err} $ are the errors.

Definition at line 1141 of file vec_stats.h.

◆ vector_chi_squared() [2/2]

template<class vec_t , class vec2_t , class vec3_t >
double o2scl::vector_chi_squared ( const vec_t &  obs,
const vec2_t &  exp,
const vec3_t &  err 
)

This function computes

\[ \sum_i \left( \frac{\mathrm{obs}_i - \mathrm{exp}_i} {\mathrm{err}_i}\right)^2 \]

where $ \mathrm{obs} $ are the observed values, $ \mathrm{exp} $ are the expected values, and $ \mathrm{err} $ are the errors.

Definition at line 1162 of file vec_stats.h.

◆ vector_copy() [1/2]

template<class vec_t , class vec2_t >
void o2scl::vector_copy ( const vec_t &  src,
vec2_t &  dest 
)

Copy src to dest, resizing dest if it is too small to hold src.size() elements.

This function will work for any classes vec_t and vec2_t which have suitably defined operator[], size(), and resize() methods.

Definition at line 127 of file vector.h.

◆ vector_copy() [2/2]

template<class vec_t , class vec2_t >
void o2scl::vector_copy ( size_t  N,
const vec_t &  src,
vec2_t &  dest 
)

Copy the first N elements of src to dest. It is assumed that the memory allocation for dest has already been performed.

This function will work for any class vec2_t which has an operator[] which returns a reference to the corresponding element and class vec_t with an operator[] which returns either a reference or the value of the corresponding element.

Definition at line 156 of file vector.h.

◆ vector_correlation() [1/2]

template<class vec_t , class vec2_t >
double o2scl::vector_correlation ( size_t  n,
const vec_t &  data1,
const vec2_t &  data2 
)

This function computes the Pearson correlation coefficient between data1 and data2 .

This function produces the same results as gsl_stats_correlation().

If n is zero, this function will call the error handler.

Definition at line 907 of file vec_stats.h.

◆ vector_correlation() [2/2]

template<class vec_t , class vec2_t >
double o2scl::vector_correlation ( const vec_t &  data1,
const vec2_t &  data2 
)

This function computes the Pearson correlation coefficient between data1 and data2 .

This function produces the same results as gsl_stats_correlation().

If n is zero, this function will call the error handler.

Definition at line 971 of file vec_stats.h.

◆ vector_covariance() [1/4]

template<class vec_t , class vec2_t >
double o2scl::vector_covariance ( size_t  n,
const vec_t &  data1,
const vec2_t &  data2,
double  mean1,
double  mean2 
)

This function computes

\[ \frac{1}{n-1} \sum_i \left(x_i - {\bar{x}}\right) \left(y_i - {\bar{y}}\right) \]

where $ {\bar{x}} $ and $ {\bar{y}} $ are specified in mean1 and mean2, respectively.

This function produces the same results as gsl_stats_covariance_m().

If n is zero, this function will return zero without calling the error handler.

Definition at line 800 of file vec_stats.h.

◆ vector_covariance() [2/4]

template<class vec_t , class vec2_t >
double o2scl::vector_covariance ( const vec_t &  data1,
const vec2_t &  data2,
double  mean1,
double  mean2 
)

This function computes

\[ \frac{1}{n-1} \sum_i \left(x_i - {\bar{x}}\right) \left(y_i - {\bar{y}}\right) \]

where $ {\bar{x}} $ and $ {\bar{y}} $ are specified in mean1 and mean2, respectively.

This function produces the same results as gsl_stats_covariance_m().

If n is zero, this function will return zero without calling the error handler.

Definition at line 828 of file vec_stats.h.

◆ vector_covariance() [3/4]

template<class vec_t , class vec2_t >
double o2scl::vector_covariance ( size_t  n,
const vec_t &  data1,
const vec2_t &  data2 
)

This function computes

\[ \frac{1}{n-1} \sum_i \left(x_i - {\bar{x}}\right) \left(y_i - {\bar{y}}\right) \]

where $ {\bar{x}} $ and $ {\bar{y}} $ are the averages of data1 and data2 and are computed automatically using vector_mean().

This function produces the same results as gsl_stats_covariance().

If n is zero, this function will return zero without calling the error handler.

Definition at line 851 of file vec_stats.h.

◆ vector_covariance() [4/4]

template<class vec_t , class vec2_t >
double o2scl::vector_covariance ( const vec_t &  data1,
const vec2_t &  data2 
)

This function computes

\[ \frac{1}{n-1} \sum_i \left(x_i - {\bar{x}}\right) \left(y_i - {\bar{y}}\right) \]

where $ {\bar{x}} $ and $ {\bar{y}} $ are the averages of data1 and data2 and are computed automatically using vector_mean().

This function produces the same results as gsl_stats_covariance().

If n is zero, this function will return zero without calling the error handler.

Definition at line 882 of file vec_stats.h.

◆ vector_find_level()

template<class vec_t , class vec2_t >
void o2scl::vector_find_level ( double  level,
size_t  n,
vec_t &  x,
vec2_t &  y,
std::vector< double > &  locs 
)

This function performs inverse linear interpolation of the data defined by x and y, finding all points in x which have the property $ \mathrm{level} = y(x) $. All points for which this relation holds are put into the vector locs. The previous information contained in vector locs before the function call is destroyed.

This is the 1-dimensional analog of finding contour levels as the contour class does for 2 dimensions.

This function will call the error handler if n is less than two.

This function is inclusive of the endpoints, so that if either y[0] and/or y[n-1] is equal to level, then x[0] and/or x[n-1] are added to locs, respectively.

Definition at line 1965 of file interp.h.

◆ vector_integ_durand()

template<class vec_t >
double o2scl::vector_integ_durand ( size_t  n,
vec_t &  v 
)

This function falls back to the equivalent of vector_integ_threept() for 3 points.

Definition at line 268 of file vector_derint.h.

◆ vector_integ_extended4()

template<class vec_t >
double o2scl::vector_integ_extended4 ( size_t  n,
vec_t &  v 
)

This function falls back to the equivalent of vector_integ_threept() for 3 points.

Definition at line 245 of file vector_derint.h.

◆ vector_integ_extended8()

template<class vec_t >
double o2scl::vector_integ_extended8 ( size_t  n,
vec_t &  v 
)

This function falls back to vector_integ_extended4() for less than 8 points.

Definition at line 291 of file vector_derint.h.

◆ vector_integ_linear()

template<class vec_t , class vec2_t >
double o2scl::vector_integ_linear ( size_t  n,
vec_t &  x,
vec2_t &  y 
)

Assuming vectors y and x define a function $ y(x) $ then this computes

\[ \int_{x_0}^{x^{n-1}} y(x)~dx \]

using the trapezoidal rule implied by linear interpolation.

Idea for Future:
It might be faster to compute the sum directly rather than going through an o2scl::interp object .

Definition at line 2011 of file interp.h.

◆ vector_integ_threept()

template<class vec_t >
double o2scl::vector_integ_threept ( size_t  n,
vec_t &  v 
)
Note
This function uses an untested hack I wrote for even n.

Definition at line 213 of file vector_derint.h.

◆ vector_invert_enclosed_sum()

template<class vec_t , class vec2_t >
void o2scl::vector_invert_enclosed_sum ( double  sum,
size_t  n,
vec_t &  x,
vec2_t &  y,
double &  lev,
int  verbose = 0 
)

Defining a new function, $ g(y_0) $ which takes as input any y-value, $ y_0 $ from the function $ y(x) $ (specified with the parameters x and y) and outputs the integral of the function $ y(x) $ over all regions where $ y(x) > y_0 $. This function inverts $ g(y) $, taking the value of an integral as input, and returns the corresponding y-value in the variable lev.

In order to make sure that the intepretation of the integral is unambiguous, this function requires that the first and last values of y are equal, i.e. y[0]==y[n-1]. This function also requires at least two data points, i.e. n cannot be 0 or 1.

This function is particularly useful, for example, in computing the region which defines 68% around a peak of data, thus providing $ 1~\sigma $ confidence limits.

Linear interpolation is used to describe the function $ g $, and the precision of this function is limited by this assumption. This function may also sometimes fail if sum is very close to the minimum or maximum value of the function $ g $.

Todo:
This function may also require that all of the y-vector values have the same sign or are all positive. Check this.

Definition at line 2058 of file interp.h.

◆ vector_kurtosis() [1/4]

template<class vec_t >
double o2scl::vector_kurtosis ( size_t  n,
const vec_t &  data,
double  mean,
double  stddev 
)

This function computes

\[ -3 + \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^4 \]

where the values of $ \mu $ and $ \sigma $ are given in mean and stddev.

This function produces the same results as gsl_stats_kurtosis_m_sd().

If n is zero, this function will return zero without calling the error handler.

Definition at line 518 of file vec_stats.h.

◆ vector_kurtosis() [2/4]

template<class vec_t >
double o2scl::vector_kurtosis ( const vec_t &  data,
double  mean,
double  stddev 
)

This function computes

\[ -3 + \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^4 \]

where the values of $ \mu $ and $ \sigma $ are given in mean and stddev.

This function produces the same results as gsl_stats_kurtosis_m_sd().

If n is zero, this function will return zero without calling the error handler.

Definition at line 545 of file vec_stats.h.

◆ vector_kurtosis() [3/4]

template<class vec_t >
double o2scl::vector_kurtosis ( size_t  n,
const vec_t &  data 
)

This function computes

\[ -3 + \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^4 \]

where the values of $ \mu $ and $ \sigma $ are computed using vector_mean() and vector_stddev().

This function produces the same results as gsl_stats_kurtosis().

If n is zero, this function will return zero without calling the error handler.

Definition at line 566 of file vec_stats.h.

◆ vector_kurtosis() [4/4]

template<class vec_t >
double o2scl::vector_kurtosis ( const vec_t &  data)

This function computes

\[ -3 + \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^4 \]

where the values of $ \mu $ and $ \sigma $ are computed using vector_mean() and vector_stddev().

This function produces the same results as gsl_stats_kurtosis().

If n is zero, this function will return zero without calling the error handler.

Definition at line 588 of file vec_stats.h.

◆ vector_lag1_autocorr() [1/4]

template<class vec_t >
double o2scl::vector_lag1_autocorr ( size_t  n,
const vec_t &  data,
double  mean 
)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-1} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

This function produces the same results as gsl_stats_lag1_autocorrelation_m().

If n is less than 2, this function will call the error handler.

Definition at line 609 of file vec_stats.h.

◆ vector_lag1_autocorr() [2/4]

template<class vec_t >
double o2scl::vector_lag1_autocorr ( const vec_t &  data,
double  mean 
)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-1} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

This function produces the same results as gsl_stats_lag1_autocorrelation_m().

If n is less than 2, this function will call the error handler.

Definition at line 645 of file vec_stats.h.

◆ vector_lag1_autocorr() [3/4]

template<class vec_t >
double o2scl::vector_lag1_autocorr ( size_t  n,
const vec_t &  data 
)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-1} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

This function produces the same results as gsl_stats_lag1_autocorrelation().

If n is less than 2, this function will call the error handler.

Definition at line 666 of file vec_stats.h.

◆ vector_lag1_autocorr() [4/4]

template<class vec_t >
double o2scl::vector_lag1_autocorr ( const vec_t &  data)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-1} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

This function produces the same results as gsl_stats_lag1_autocorrelation().

If n is less than 2, this function will call the error handler.

Definition at line 687 of file vec_stats.h.

◆ vector_lagk_autocorr() [1/4]

template<class vec_t >
double o2scl::vector_lagk_autocorr ( size_t  n,
const vec_t &  data,
size_t  k,
double  mean 
)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-k} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

If n<=k, this function will call the error handler.

Definition at line 705 of file vec_stats.h.

◆ vector_lagk_autocorr() [2/4]

template<class vec_t >
double o2scl::vector_lagk_autocorr ( const vec_t &  data,
size_t  k,
double  mean 
)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-k} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

If n<=k, this function will call the error handler.

Definition at line 741 of file vec_stats.h.

◆ vector_lagk_autocorr() [3/4]

template<class vec_t >
double o2scl::vector_lagk_autocorr ( size_t  n,
const vec_t &  data,
size_t  k 
)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-k} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

If n<=k, this function will call the error handler.

Definition at line 760 of file vec_stats.h.

◆ vector_lagk_autocorr() [4/4]

template<class vec_t >
double o2scl::vector_lagk_autocorr ( const vec_t &  data,
size_t  k 
)

This function computes

\[ \left[ \sum_i \left(x_i - \mu\right) \left(x_{i-k} - \mu \right) \right] \left[ \sum_i \left(x_i - \mu\right)^2 \right]^{-1} \]

If n<=k, this function will call the error handler.

Definition at line 779 of file vec_stats.h.

◆ vector_largest() [1/2]

template<class vec_t , class data_t >
void o2scl::vector_largest ( size_t  n,
vec_t &  data,
size_t  k,
vec_t &  largest 
)

Given a vector data of size n this sets the first k entries of the vector largest to the k largest entries from vector data in descending order. The vector largest must be allocated beforehand to hold at least k elements.

This works similarly to the GSL function gsl_sort_largest().

Note
This $ {\cal O}(k N) $ algorithm is useful only when $ k << N $.

If k is zero, then this function does nothing and returns o2scl::success .

Definition at line 1015 of file vector.h.

◆ vector_largest() [2/2]

template<class vec_t , class data_t >
void o2scl::vector_largest ( vec_t &  data,
size_t  k,
vec_t &  largest 
)

Given a vector data, this function sets the first k entries of the vector largest to the k largest entries from vector data in ascending order. The vector largest is resized if necessary to hold at least k elements.

This works similarly to the GSL function gsl_sort_largest().

Note
This $ {\cal O}(k N) $ algorithm is useful only when $ k << N $.

If k is zero, then this function does nothing and returns o2scl::success .

Definition at line 1066 of file vector.h.

◆ vector_level_count()

template<class vec_t , class vec2_t >
size_t o2scl::vector_level_count ( double  level,
size_t  n,
vec_t &  x,
vec2_t &  y 
)

This function counts the number of times the function $ y(x) = \mathrm{level} $ where the function is defined by the vectors x and y.

The value returned is exactly the same as the size of the locs vector computed by vector_find_level().

This function will call the error handler if n is less than two.

If one of the entries in y is either larger or smaller than it's neighbors (i.e. if the function $ y(x) $ has an extremum), and if the value of level is exactly equal to the extremum, then this is counted as 1 level crossing. The same applies if either the first or last entry in y is exactly equal to level .

Definition at line 1920 of file interp.h.

◆ vector_lookup() [1/2]

template<class vec_t >
size_t o2scl::vector_lookup ( size_t  n,
const vec_t &  x,
double  x0 
)

The function finds the element among the first n elements of x which is closest to the value x0. It ignores all elements in x which are not finite. If the vector is empty, or if all of the first n elements in x are not finite, then the error handler will be called.

This function works for all classes vec_t where an operator[] is defined which returns a double (either as a value or a reference).

Definition at line 1737 of file vector.h.

◆ vector_lookup() [2/2]

template<class vec_t >
size_t o2scl::vector_lookup ( const vec_t &  x,
double  x0 
)

This function finds the element in vector x which is closest to x0. It ignores all elements in x which are not finite. If the vector is empty, or if all of the elements in x are not finite, then the error handler will be called.

This function works for all classes vec_t with a size() method and where an operator[] is defined which returns a double (either as a value or a reference).

Definition at line 1774 of file vector.h.

◆ vector_mean() [1/2]

template<class vec_t >
double o2scl::vector_mean ( size_t  n,
const vec_t &  data 
)

This function produces the same results as gsl_stats_mean().

If n is zero, this function will return zero.

Definition at line 55 of file vec_stats.h.

◆ vector_mean() [2/2]

template<class vec_t >
double o2scl::vector_mean ( const vec_t &  data)

This function uses size() to determine the vector size and produces the same results as gsl_stats_mean().

If the vector size is zero, this function will return zero.

Definition at line 70 of file vec_stats.h.

◆ vector_median_sorted() [1/2]

template<class vec_t >
double o2scl::vector_median_sorted ( size_t  n,
const vec_t &  data 
)

This function returns the median of sorted data (either ascending or descending), assuming the data has already been sorted. When the data set has an odd number of elements, the median is the value of the element at index $ (n-1)/2 $, otherwise, the median is taken to be the average of the elements at indices $ (n-1)/2 $ and $ n/2 $ .

This function produces the same results as gsl_stats_median_from_sorted_data().

No checks are made to ensure the data is sorted. If n is zero, this function will return zero without calling the error handler.

Definition at line 1096 of file vec_stats.h.

◆ vector_median_sorted() [2/2]

template<class vec_t >
double o2scl::vector_median_sorted ( const vec_t &  data)

This function returns the median of sorted data (either ascending or descending), assuming the data has already been sorted. When the data set has an odd number of elements, the median is the value of the element at index $ (n-1)/2 $, otherwise, the median is taken to be the average of the elements at indices $ (n-1)/2 $ and $ n/2 $ .

This function produces the same results as gsl_stats_median_from_sorted_data().

No checks are made to ensure the data is sorted. If n is zero, this function will return zero without calling the error handler.

Definition at line 1125 of file vec_stats.h.

◆ vector_norm()

template<class vec_t , class data_t >
data_t o2scl::vector_norm ( size_t  n,
const vec_t &  x 
)

This function is a more generic version of o2scl_cblas::dnrm2 .

Definition at line 2025 of file vector.h.

◆ vector_norm_double()

template<class vec_t >
double o2scl::vector_norm_double ( size_t  n,
const vec_t &  x 
)

This function is a more generic version of o2scl_cblas::dnrm2 .

Definition at line 2069 of file vector.h.

◆ vector_out() [1/2]

template<class vec_t >
void o2scl::vector_out ( std::ostream &  os,
size_t  n,
const vec_t &  v,
bool  endline = false 
)

No trailing space is output after the last element, and an endline is output only if endline is set to true. If the parameter n is zero, this function silently does nothing.

This works with any class vec_t which has an operator[] which returns either the value of or a reference to the ith element and the element type has its own output operator which has been defined.

Definition at line 2319 of file vector.h.

◆ vector_out() [2/2]

template<class vec_t >
void o2scl::vector_out ( std::ostream &  os,
const vec_t &  v,
bool  endline = false 
)

No trailing space is output after the last element, and an endline is output only if endline is set to true. If the parameter n is zero, this function silently does nothing.

This works with any class vec_t which has an operator[] which returns either the value of or a reference to the ith element and the element type has its own output operator which has been defined.

Definition at line 2343 of file vector.h.

◆ vector_pvariance() [1/2]

template<class vec_t , class vec2_t >
double o2scl::vector_pvariance ( size_t  n1,
const vec_t &  data1,
size_t  n2,
const vec2_t &  data2 
)

This function computes

\[ s_{p}^2 = \frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2} \]

where $ n_i $ is the number of elements in vector $ i $ and $ s_i^2 $ is the variance of vector $ i $.

From http://en.wikipedia.org/wiki/Pooled_variance, "Under the assumption of equal population variances, the pooled sample variance provides a higher precision estimate of variance than the individual sample variances."

This function produces the same results as gsl_stats_pvariance().

Definition at line 994 of file vec_stats.h.

◆ vector_pvariance() [2/2]

template<class vec_t , class vec2_t >
double o2scl::vector_pvariance ( const vec_t &  data1,
const vec2_t &  data2 
)

This function computes

\[ s_{p}^2 = \frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2} \]

where $ n_i $ is the number of elements in vector $ i $ and $ s_i^2 $ is the variance of vector $ i $.

From http://en.wikipedia.org/wiki/Pooled_variance, "Under the assumption of equal population variances, the pooled sample variance provides a higher precision estimate of variance than the individual sample variances."

This function produces the same results as gsl_stats_pvariance().

Definition at line 1019 of file vec_stats.h.

◆ vector_quantile_sorted() [1/2]

template<class vec_t >
double o2scl::vector_quantile_sorted ( size_t  n,
const vec_t &  data,
const double  f 
)

This function returns the quantile f of data which has already been sorted in ascending order. The quantile, $ q $ , is found by interpolation using

\[ q = \left(1-\delta\right) x_i \delta x_{i+1} \]

where $ i = \mathrm{floor}[ (n-1)f ] $ and $ \delta = (n-1)f -i $ .

This function produces the same results as gsl_stats_quantile_from_sorted_data().

No checks are made to ensure the data is sorted, or to ensure that $ 0 \leq 0 \leq 1 $. If n is zero, this function will return zero without calling the error handler.

Definition at line 1044 of file vec_stats.h.

◆ vector_quantile_sorted() [2/2]

template<class vec_t >
double o2scl::vector_quantile_sorted ( const vec_t &  data,
const double  f 
)

This function returns the quantile f of data which has already been sorted in ascending order. The quantile, $ q $ , is found by interpolation using

\[ q = \left(1-\delta\right) x_i \delta x_{i+1} \]

where $ i = \mathrm{floor}[ (n-1)f ] $ and $ \delta = (n-1)f -i $ .

This function produces the same results as gsl_stats_quantile_from_sorted_data().

No checks are made to ensure the data is sorted, or to ensure that $ 0 \leq 0 \leq 1 $. If n is zero, this function will return zero without calling the error handler.

Definition at line 1075 of file vec_stats.h.

◆ vector_range() [1/3]

template<class dat_t >
dat_t* o2scl::vector_range ( dat_t *  v,
size_t  start,
size_t  last 
)
Note
In this case, the return type is the same as the type of the first parameter.

Definition at line 2384 of file vector.h.

◆ vector_range() [2/3]

template<class dat_t >
boost::numeric::ublas::vector_range<boost::numeric::ublas::vector<dat_t> > o2scl::vector_range ( boost::numeric::ublas::vector< dat_t > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is not the same as the type of the first parameter.

Definition at line 2409 of file vector.h.

◆ vector_range() [3/3]

template<class dat_t >
boost::numeric::ublas::vector_range<boost::numeric::ublas::vector_range <boost::numeric::ublas::vector<dat_t> > > o2scl::vector_range ( boost::numeric::ublas::vector_range< boost::numeric::ublas::vector< dat_t > > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is not the same as the type of the first parameter.

Definition at line 2468 of file vector.h.

◆ vector_range_copy() [1/2]

template<class dat_t >
std::vector<dat_t> o2scl::vector_range_copy ( const std::vector< dat_t > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is the same as the type of the first parameter.
Unlike the ublas and pointer cases, this forces a copy.

Definition at line 2784 of file vector.h.

◆ vector_range_copy() [2/2]

template<class dat_t >
const std::vector<dat_t> o2scl::vector_range_copy ( const std::vector< dat_t > &  v,
size_t  start,
size_t  last 
)

The element with index start in the original vector will become the first argument in the new vector, and the new vector will have size last-start .

Note
In this case, the return type is the same as the type of the first parameter.
Unlike the ublas and pointer cases, this forces a copy.

Definition at line 2800 of file vector.h.

◆ vector_reverse() [1/2]

template<class vec_t , class data_t >
void o2scl::vector_reverse ( size_t  n,
vec_t &  data 
)

If n is zero, this function will silently do nothing.

Definition at line 2141 of file vector.h.

◆ vector_reverse() [2/2]

template<class vec_t , class data_t >
void o2scl::vector_reverse ( vec_t &  data)

If the size() method returns zero, this function will silently do nothing.

Definition at line 2158 of file vector.h.

◆ vector_reverse_double() [1/2]

template<class vec_t >
void o2scl::vector_reverse_double ( size_t  n,
vec_t &  data 
)

If n is zero, this function will silently do nothing.

Definition at line 2176 of file vector.h.

◆ vector_reverse_double() [2/2]

template<class vec_t >
void o2scl::vector_reverse_double ( vec_t &  data)

If the size() method returns zero, this function will silently do nothing.

Definition at line 2192 of file vector.h.

◆ vector_rotate()

template<class vec_t , class data_t >
void o2scl::vector_rotate ( size_t  n,
vec_t &  data,
size_t  k 
)

This is a generic template function which will work for any types data_t and vec_t for which

  • data_t has an operator=
  • vec_t::operator[] returns a reference to an object of type data_t

This function is used, for example, in o2scl::pinside.

Note
This function is not the same as a Givens rotation, which is typically referred to in BLAS routines as drot().

Definition at line 2122 of file vector.h.

◆ vector_skew() [1/4]

template<class vec_t >
double o2scl::vector_skew ( size_t  n,
const vec_t &  data,
double  mean,
double  stddev 
)

This function computes

\[ \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^3 \]

where the values of $ \mu $ and $ \sigma $ are given in mean and stddev.

This function produces the same results as gsl_stats_skew_m_sd().

If n is zero, this function will return zero without calling the error handler.

Definition at line 428 of file vec_stats.h.

◆ vector_skew() [2/4]

template<class vec_t >
double o2scl::vector_skew ( const vec_t &  data,
double  mean,
double  stddev 
)

This function computes

\[ \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^3 \]

where the values of $ \mu $ and $ \sigma $ are given in mean and stddev.

This function produces the same results as gsl_stats_skew_m_sd().

If n is zero, this function will return zero without calling the error handler.

Definition at line 454 of file vec_stats.h.

◆ vector_skew() [3/4]

template<class vec_t >
double o2scl::vector_skew ( size_t  n,
const vec_t &  data 
)

This function computes

\[ \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^3 \]

where the values of $ \mu $ and $ \sigma $ are computed using vector_mean() and vector_stddev().

This function produces the same results as gsl_stats_skew().

If n is zero, this function will return zero without calling the error handler.

Definition at line 475 of file vec_stats.h.

◆ vector_skew() [4/4]

template<class vec_t >
double o2scl::vector_skew ( const vec_t &  data)

This function computes

\[ \frac{1}{N} \sum_i \left[ \frac{ \left(x_i - \mu \right)}{ \sigma }\right]^3 \]

where the values of $ \mu $ and $ \sigma $ are computed using vector_mean() and vector_stddev().

This function produces the same results as gsl_stats_skew().

If n is zero, this function will return zero without calling the error handler.

Definition at line 497 of file vec_stats.h.

◆ vector_smallest() [1/2]

template<class vec_t , class data_t >
void o2scl::vector_smallest ( size_t  n,
vec_t &  data,
size_t  k,
vec_t &  smallest 
)

Given a vector data of size n, this function sets the first k entries of the vector smallest to the k smallest entries from vector data in ascending order. The vector smallest must be allocated beforehand to hold at least k elements.

This works similarly to the GSL function gsl_sort_smallest().

Note
This $ {\cal O}(k N) $ algorithm is useful only when $ k << N $.

If k is zero, then this function does nothing and returns o2scl::success .

Definition at line 877 of file vector.h.

◆ vector_smallest() [2/2]

template<class vec_t , class data_t >
void o2scl::vector_smallest ( vec_t &  data,
size_t  k,
vec_t &  smallest 
)

Given a vector data, this function sets the first k entries of the vector smallest to the k smallest entries from vector data in ascending order. The vector smallest is resized if necessary to hold at least k elements.

This works similarly to the GSL function gsl_sort_smallest().

Note
This $ {\cal O}(k N) $ algorithm is useful only when $ k << N $.

If k is zero, then this function does nothing and returns o2scl::success .

Definition at line 928 of file vector.h.

◆ vector_smallest_index()

template<class vec_t , class data_t , class vec_size_t >
void o2scl::vector_smallest_index ( size_t  n,
vec_t &  data,
size_t  k,
vec_size_t &  index 
)

Given a vector data, this function sets the first k entries of the vector smallest equal to the indexes of the k smallest entries from vector data in ascending order. The vector smallest is resized if necessary to hold at least k elements.

Note
This $ {\cal O}(k N) $ algorithm is useful only when $ k << N $.

If k is zero or n is zero or $ k > n$, then this function calls the error handler.

Definition at line 950 of file vector.h.

◆ vector_sort()

template<class vec_t , class data_t >
void o2scl::vector_sort ( size_t  n,
vec_t &  data 
)

This is a generic sorting template function using a heapsort algorithm. It will work for any types data_t and vec_t for which

  • data_t has a non-const version of operator=
  • data_t has a less than operator to compare elements
  • vec_t::operator[] returns a non-const reference to an object of type data_t

In particular, it will work with the STL template class std::vector, and arrays and pointers of numeric, character, and string objects.

For example,

std::string list[3]={"dog","cat","fox"};
vector_sort<std::string[3],std::string>(3,list);
Note
With this function template alone, the user cannot avoid explicitly specifying the template types for this function because there is no parameter of type data_t, and function templates cannot handle default template types. For this reason, the function template o2scl::vector_sort_double() was also created which provides the convenience of not requiring the user to specify the vector template type.
This sorting routine is not stable, i.e. equal elements have arbtrary final ordering
If n is zero, this function will do nothing and will not call the error handler.

This works similarly to the GSL function gsl_sort_vector().

Definition at line 708 of file vector.h.

◆ vector_sort_double()

template<class vec_t >
void o2scl::vector_sort_double ( size_t  n,
vec_t &  data 
)

This function is just a wrapper for

vector_sort<vec_t,double>(n,data);

See the documentation of o2scl::vector_sort() for more details.

Definition at line 852 of file vector.h.

◆ vector_sort_index()

template<class vec_t , class vec_size_t >
void o2scl::vector_sort_index ( size_t  n,
const vec_t &  data,
vec_size_t &  order 
)

This function takes a vector data and arranges a list of indices in order, which give a sorted version of the vector. The value order[i] gives the index of entry in in data which corresponds to the ith value in the sorted vector. The vector data is unchanged by this function, and the initial values in order are ignored. Before calling this function, order must already be allocated as a vector of size n.

For example, after calling this function, a sorted version the vector can be output with

size_t n=5;
double data[5]={3.1,4.1,5.9,2.6,3.5};
permutation order(n);
vector_sort_index(n,data,order);
for(size_t i=0;i<n;i++) {
cout << data[order[i]] << endl;
}

To create a permutation which stores as its ith element, the index of data[i] in the sorted vector, you can invert the permutation created by this function.

This is a generic sorting template function. It will work for any types vec_t and vec_size_t for which

  • vec_t has an operator[], and
  • vec_size_t has an operator[] which returns a size_t . One possible type for vec_size_t is o2scl::permutation.

This works similarly to the GSL function gsl_sort_index().

Definition at line 801 of file vector.h.

◆ vector_stddev() [1/4]

template<class vec_t >
double o2scl::vector_stddev ( size_t  n,
const vec_t &  data 
)

This function computes

\[ \sqrt{\frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2} \]

where $ \mu $ is the mean computed with vector_mean().

This function produces the same results as gsl_stats_sd().

If n is 0 or 1, this function will call the error handler.

Definition at line 253 of file vec_stats.h.

◆ vector_stddev() [2/4]

template<class vec_t >
double o2scl::vector_stddev ( const vec_t &  data)

This function computes

\[ \sqrt{\frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2} \]

where $ \mu $ is the mean computed with vector_mean().

This function produces the same results as gsl_stats_sd().

If n is 0 or 1, this function will call the error handler.

Definition at line 278 of file vec_stats.h.

◆ vector_stddev() [3/4]

template<class vec_t >
double o2scl::vector_stddev ( size_t  n,
const vec_t &  data,
double  mean 
)

This function computes

\[ \sqrt{\frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2} \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_sd_m().

If n is 0 or 1, this function will call the error handler.

Definition at line 296 of file vec_stats.h.

◆ vector_stddev() [4/4]

template<class vec_t >
double o2scl::vector_stddev ( const vec_t &  data,
double  mean 
)

This function computes

\[ \sqrt{\frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2} \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_sd_m().

If n is 0 or 1, this function will call the error handler.

Definition at line 322 of file vec_stats.h.

◆ vector_stddev_fmean() [1/2]

template<class vec_t >
double o2scl::vector_stddev_fmean ( size_t  n,
const vec_t &  data,
double  mean 
)

This function computes

\[ \sqrt{\frac{1}{N} \sum_{i} \left( x_i - \mu \right)^2} \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_sd_with_fixed_mean().

If n is zero, this function will return zero without calling the error handler.

Definition at line 215 of file vec_stats.h.

◆ vector_stddev_fmean() [2/2]

template<class vec_t >
double o2scl::vector_stddev_fmean ( const vec_t &  data,
double  mean 
)

This function computes

\[ \sqrt{\frac{1}{N} \sum_{i} \left( x_i - \mu \right)^2} \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_sd_with_fixed_mean().

If n is zero, this function will return zero without calling the error handler.

Definition at line 236 of file vec_stats.h.

◆ vector_sum() [1/2]

template<class vec_t , class data_t >
data_t o2scl::vector_sum ( size_t  n,
vec_t &  data 
)

If n is zero, this will return 0 without throwing an exception.

Definition at line 1968 of file vector.h.

◆ vector_sum() [2/2]

template<class vec_t , class data_t >
data_t o2scl::vector_sum ( vec_t &  data)

If the vector has zero size, this will return 0 without throwing an exception.

Definition at line 1982 of file vector.h.

◆ vector_sum_double() [1/2]

template<class vec_t >
double o2scl::vector_sum_double ( size_t  n,
vec_t &  data 
)

If n is zero, this will return 0 without throwing an exception.

Definition at line 1996 of file vector.h.

◆ vector_sum_double() [2/2]

template<class vec_t >
double o2scl::vector_sum_double ( vec_t &  data)

If the vector has zero size, this will return 0 without throwing an exception.

Definition at line 2010 of file vector.h.

◆ vector_swap() [1/3]

template<class vec_t , class vec2_t , class data_t >
void o2scl::vector_swap ( size_t  N,
vec_t &  v1,
vec2_t &  v2 
)

This function swaps the elements of v1 and v2, one element at a time.

Definition at line 423 of file vector.h.

◆ vector_swap() [2/3]

template<class vec_t , class vec2_t , class data_t >
void o2scl::vector_swap ( vec_t &  v1,
vec2_t &  v2 
)

This function swaps the elements of v1 and v2, one element at a time.

Note
It is almost always better to use std::swap than this function, which is provided only in cases where one knows one is going to be forced to use a vector type without a properly defined std::swap method.

Definition at line 459 of file vector.h.

◆ vector_swap() [3/3]

template<class vec_t , class data_t >
void o2scl::vector_swap ( vec_t &  v,
size_t  i,
size_t  j 
)

This function swaps the element i and element j of vector v1.

Definition at line 519 of file vector.h.

◆ vector_swap_double() [1/3]

template<class vec_t , class vec2_t >
void o2scl::vector_swap_double ( size_t  N,
vec_t &  v1,
vec2_t &  v2 
)

This function swaps the elements of v1 and v2, one element at a time.

Definition at line 493 of file vector.h.

◆ vector_swap_double() [2/3]

template<class vec_t , class vec2_t >
void o2scl::vector_swap_double ( vec_t &  v1,
vec2_t &  v2 
)

This function swaps the elements of v1 and v2, one element at a time.

Note
It is almost always better to use std::swap than this function, which is provided only in cases where one knows one is going to be forced to use a vector type without a properly defined std::swap method.

Definition at line 509 of file vector.h.

◆ vector_swap_double() [3/3]

template<class vec_t >
void o2scl::vector_swap_double ( vec_t &  v,
size_t  i,
size_t  j 
)

This function swaps the element i and element j of vector v1.

This function is used in o2scl_linalg::QRPT_decomp() .

Definition at line 534 of file vector.h.

◆ vector_variance() [1/4]

template<class vec_t >
double o2scl::vector_variance ( size_t  n,
const vec_t &  data,
double  mean 
)

This function computes

\[ \frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2 \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_variance_m.

If n is 0 or 1, this function will call the error handler.

Definition at line 128 of file vec_stats.h.

◆ vector_variance() [2/4]

template<class vec_t >
double o2scl::vector_variance ( const vec_t &  data,
double  mean 
)

This function computes

\[ \frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2 \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_variance_m.

If n is 0 or 1, this function will call the error handler.

Definition at line 154 of file vec_stats.h.

◆ vector_variance() [3/4]

template<class vec_t >
double o2scl::vector_variance ( size_t  n,
const vec_t &  data 
)

This function computes

\[ \frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2 \]

where $ \mu $ is the mean computed with vector_mean().

This function produces the same results as gsl_stats_variance.

If n is 0 or 1, this function will call the error handler.

Definition at line 171 of file vec_stats.h.

◆ vector_variance() [4/4]

template<class vec_t >
double o2scl::vector_variance ( const vec_t &  data)

This function computes

\[ \frac{1}{N-1} \sum_{i} \left( x_i - \mu \right)^2 \]

where $ \mu $ is the mean computed with vector_mean().

This function produces the same results as gsl_stats_variance.

If n is 0 or 1, this function will call the error handler.

Definition at line 196 of file vec_stats.h.

◆ vector_variance_fmean() [1/2]

template<class vec_t >
double o2scl::vector_variance_fmean ( size_t  n,
const vec_t &  data,
double  mean 
)

This function computes

\[ \frac{1}{N} \sum_{i} \left( x_i - \mu \right)^2 \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_variance_with_fixed_mean(). IF n is zero, this function returns zero.

Definition at line 87 of file vec_stats.h.

◆ vector_variance_fmean() [2/2]

template<class vec_t >
double o2scl::vector_variance_fmean ( const vec_t &  data,
double  mean 
)

This function computes

\[ \frac{1}{N} \sum_{i} \left( x_i - \mu \right)^2 \]

where the value of $ \mu $ is given in mean.

This function produces the same results as gsl_stats_variance_with_fixed_mean(). If the vector size is zero, this function will return zero.

Definition at line 109 of file vec_stats.h.

◆ wvector_absdev() [1/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_absdev ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wabsdev_m().

Definition at line 1534 of file vec_stats.h.

◆ wvector_absdev() [2/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_absdev ( const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wabsdev_m().

Definition at line 1555 of file vec_stats.h.

◆ wvector_absdev() [3/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_absdev ( size_t  n,
const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wabsdev().

Definition at line 1566 of file vec_stats.h.

◆ wvector_absdev() [4/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_absdev ( const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wabsdev().

Definition at line 1579 of file vec_stats.h.

◆ wvector_covariance() [1/2]

template<class vec_t , class vec2_t , class vec3_t >
double o2scl::wvector_covariance ( size_t  n,
const vec_t &  data1,
const vec2_t &  data2,
const vec3_t &  weights 
)
Note
Experimental

Definition at line 1363 of file vec_stats.h.

◆ wvector_covariance() [2/2]

template<class vec_t , class vec2_t , class vec3_t >
double o2scl::wvector_covariance ( const vec_t &  data1,
const vec2_t &  data2,
const vec3_t &  weights 
)
Note
Experimental

Definition at line 1387 of file vec_stats.h.

◆ wvector_factor() [1/2]

template<class vec_t >
double o2scl::wvector_factor ( size_t  n,
const vec_t &  weights 
)

This function is used internally in wvector_variance(size_t n, vec_t &data, const vec2_t &weights, double wmean) and wvector_stddev(size_t n, vec_t &data, const vec2_t &weights, double wmean) .

Definition at line 1228 of file vec_stats.h.

◆ wvector_factor() [2/2]

template<class vec_t >
double o2scl::wvector_factor ( const vec_t &  weights)

This function is used internally in wvector_variance(size_t n, vec_t &data, const vec2_t &weights, double wmean) and wvector_stddev(size_t n, vec_t &data, const vec2_t &weights, double wmean) .

Definition at line 1251 of file vec_stats.h.

◆ wvector_kurtosis() [1/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean,
double  wsd 
)

This function produces the same results as gsl_stats_wkurtosis_m_sd().

Definition at line 1648 of file vec_stats.h.

◆ wvector_kurtosis() [2/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis ( const vec_t &  data,
const vec2_t &  weights,
double  wmean,
double  wsd 
)

This function produces the same results as gsl_stats_wkurtosis_m_sd().

Definition at line 1670 of file vec_stats.h.

◆ wvector_kurtosis() [3/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis ( size_t  n,
const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wkurtosis().

Definition at line 1683 of file vec_stats.h.

◆ wvector_kurtosis() [4/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_kurtosis ( const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wkurtosis().

Definition at line 1697 of file vec_stats.h.

◆ wvector_mean() [1/2]

template<class vec_t , class vec2_t >
double o2scl::wvector_mean ( size_t  n,
const vec_t &  data,
const vec2_t &  weights 
)

This function computes

\[ \left( \sum_i w_i x_i \right) \left( \sum_i w_i \right)^{-1} \]

This function produces the same results as gsl_stats_wmean().

Definition at line 1186 of file vec_stats.h.

◆ wvector_mean() [2/2]

template<class vec_t , class vec2_t >
double o2scl::wvector_mean ( const vec_t &  data,
const vec2_t &  weights 
)

This function computes

\[ \left( \sum_i w_i x_i \right) \left( \sum_i w_i \right)^{-1} \]

This function produces the same results as gsl_stats_wmean().

Definition at line 1217 of file vec_stats.h.

◆ wvector_skew() [1/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_skew ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean,
double  wsd 
)

This function produces the same results as gsl_stats_wskew_m_sd().

Definition at line 1590 of file vec_stats.h.

◆ wvector_skew() [2/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_skew ( const vec_t &  data,
const vec2_t &  weights,
double  wmean,
double  wsd 
)

This function produces the same results as gsl_stats_wskew_m_sd().

Definition at line 1612 of file vec_stats.h.

◆ wvector_skew() [3/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_skew ( size_t  n,
const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wskew().

Definition at line 1624 of file vec_stats.h.

◆ wvector_skew() [4/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_skew ( const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wskew().

Definition at line 1637 of file vec_stats.h.

◆ wvector_stddev() [1/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_stddev ( size_t  n,
const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wsd().

Definition at line 1425 of file vec_stats.h.

◆ wvector_stddev() [2/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_stddev ( const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wsd().

Definition at line 1438 of file vec_stats.h.

◆ wvector_stddev() [3/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_stddev ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wsd_m().

Definition at line 1449 of file vec_stats.h.

◆ wvector_stddev() [4/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_stddev ( const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wsd_m().

Definition at line 1465 of file vec_stats.h.

◆ wvector_stddev_fmean() [1/2]

template<class vec_t , class vec2_t >
double o2scl::wvector_stddev_fmean ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wsd_with_fixed_mean().

Definition at line 1400 of file vec_stats.h.

◆ wvector_stddev_fmean() [2/2]

template<class vec_t , class vec2_t >
double o2scl::wvector_stddev_fmean ( const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wsd_with_fixed_mean().

Definition at line 1412 of file vec_stats.h.

◆ wvector_sumsq() [1/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wtss_m().

Definition at line 1477 of file vec_stats.h.

◆ wvector_sumsq() [2/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq ( const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wtss_m().

Definition at line 1498 of file vec_stats.h.

◆ wvector_sumsq() [3/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq ( size_t  n,
const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wtss().

Definition at line 1510 of file vec_stats.h.

◆ wvector_sumsq() [4/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_sumsq ( const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wtss().

Definition at line 1524 of file vec_stats.h.

◆ wvector_variance() [1/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_variance ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wvariance_m().

Definition at line 1311 of file vec_stats.h.

◆ wvector_variance() [2/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_variance ( const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function produces the same results as gsl_stats_wvariance_m().

Definition at line 1328 of file vec_stats.h.

◆ wvector_variance() [3/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_variance ( size_t  n,
const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wvariance().

Definition at line 1340 of file vec_stats.h.

◆ wvector_variance() [4/4]

template<class vec_t , class vec2_t >
double o2scl::wvector_variance ( const vec_t &  data,
const vec2_t &  weights 
)

This function produces the same results as gsl_stats_wvariance().

Definition at line 1354 of file vec_stats.h.

◆ wvector_variance_fmean() [1/2]

template<class vec_t , class vec2_t >
double o2scl::wvector_variance_fmean ( size_t  n,
const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function computes

\[ \left[ \sum_i w_i \left(x_i-\mu\right)^2 \right] \left[ \sum_i w_i \right]^{-1} \]

This function produces the same results as gsl_stats_wvariance_with_fixed_mean().

Definition at line 1269 of file vec_stats.h.

◆ wvector_variance_fmean() [2/2]

template<class vec_t , class vec2_t >
double o2scl::wvector_variance_fmean ( const vec_t &  data,
const vec2_t &  weights,
double  wmean 
)

This function computes

\[ \left[ \sum_i w_i \left(x_i-\mu\right)^2 \right] \left[ \sum_i w_i \right]^{-1} \]

This function produces the same results as gsl_stats_wvariance_with_fixed_mean().

Definition at line 1299 of file vec_stats.h.

Variable Documentation

◆ o2scl_settings

lib_settings_class o2scl::o2scl_settings

This global object is used by polylog and some of the O2scl_eos classes to find data files. It may also be used by the end-user to probe details of the O2scl installation.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).