ALERT
Loading...
Searching...
No Matches
futils.h
1// futils : f stands for felix
2
3#ifndef FUTILS_H
4#define FUTILS_H
5
6#include "dictionary.h"
7#include <vector>
8
9typedef double (*Integrable)(double);
10
11/*
12class Integrable {
13 private :
14 double (*ptr) (double) = nullptr;
15 void get_ptr(double (*ptr_) (double)) const {ptr_=ptr; return;}
16 public :
17 Integrable(double (*ptr_) (double)){ptr = ptr_;}
18 Integrable(const Integrable & func){func.get_ptr(ptr);}
19 Integrable(){ptr=nullptr;}
20 ~Integrable(){;}
21
22 virtual double operator()(double x){
23 return (*ptr)(x);
24 }
25};*/
26
27namespace futils {
28
29 // Statistical analysis
30 double mean(const std::vector<double> & data);
31 double variance(const std::vector<double> & data);
32 double std_dev(const std::vector<double> & data);
33 bool cart2polar(double x, double y, double z, double & rho, double & theta, double & phi);
34 bool cart2polar(double x, double y, double & rho, double & theta);
35 double integrate(Integrable f, double a, double b, int Npts);
36}
37
38
39
40
41#endif