File indexing completed on 2025-08-03 08:19:42
0001
0002
0003
0004 #ifndef arsenal_h
0005 #define arsenal_h
0006
0007 #include <cmath>
0008 #include "stdlib.h"
0009 #include <vector>
0010 #include <string>
0011
0012
0013 using std::string;
0014 using std::vector;
0015 using std::ofstream;
0016 using std::ifstream;
0017 using std::ostream;
0018 using std::istream;
0019 using std::abs;
0020
0021 double sixPoint2dInterp(double x, double y,
0022 double v00, double v01, double v02, double v10, double v11, double v20);
0023
0024 double interpCubicDirect(vector<double>* x, vector<double>* y, double xx);
0025 double interpCubicMono(vector<double>* x, vector<double>* y, double xx);
0026 double interpLinearDirect(vector<double>* x, vector<double>* y, double xx);
0027 double interpLinearMono(vector<double>* x, vector<double>* y, double xx);
0028 double interpNearestDirect(vector<double>* x, vector<double>* y, double xx);
0029 double interpNearestMono(vector<double>* x, vector<double>* y, double xx);
0030
0031 double invertFunc(double (*func)(double), double y, double xL, double xR, double dx, double x0, double relative_accuracy=1e-10);
0032
0033 double invertTableDirect_hook(double xx);
0034 double invertTableDirect(vector<double>* x, vector<double>* y, double y0, double x0, double relative_accuracy=1e-10);
0035
0036 double stringToDouble(string);
0037 vector<double> stringToDoubles(string);
0038 string toLower(string str);
0039 string trim(string str);
0040
0041 vector< vector<double>* >* readBlockData(istream &stream_in);
0042 void releaseBlockData(vector< vector<double>* >* data);
0043
0044 double adaptiveSimpsonsAux(double (*f)(double), double a, double b, double epsilon, double S, double fa, double fb, double fc, int bottom);
0045 double adaptiveSimpsons(double (*f)(double), double a, double b, double epsilon=1e-15, int maxRecursionDepth=50);
0046
0047 double qiu_simpsons(double (*f)(double), double a, double b, double epsilon=1e-15, int maxRecursionDepth=50);
0048 double qiu_simpsonsRel(double (*f)(double), double a, double b, double epsilon=1e-15, int maxRecursionDepth=50);
0049 long binarySearch(vector<double>* A, double value, bool skip_out_of_range=false);
0050
0051 void formatedPrint(ostream&, int count, ...);
0052 long double gamma_function(long double x);
0053 long double log_gamma_function(long double x);
0054 double beta_function(double, double);
0055 double binomial_coefficient(double n, double k);
0056
0057 void print_progressbar(double percentage, int length=50, string symbol="#");
0058 void display_logo(int which=1);
0059
0060 inline long irand(long LB, long RB)
0061
0062 {
0063 return LB + (long)((RB-LB+1)*(drand48()-1e-25));
0064 }
0065
0066 inline double drand(double LB, double RB)
0067
0068
0069 {
0070 double width = RB-LB;
0071 double dw = width*1e-30;
0072 return LB+dw+(width-2*dw)*drand48();
0073 }
0074
0075 inline bool is_integer(double x, double tolerance=1e-30)
0076
0077 {
0078 if (abs(x-round(x))<tolerance) return true;
0079 else return false;
0080 }
0081
0082 void GaussLegendre_getWeight(int npts,double* x,double* w, double A, double B, int opt);
0083
0084 void get_bin_average_and_count(istream& is, ostream& os, vector<double>* bins, long col_to_bin=0, void (*func)(vector<double>*)=NULL, long wanted_data_columns=-1, bool silence=false);
0085
0086 #endif
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130