MURE
|
Methods for linear regression and auxiliaries for error logging. More...
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include "MiscFunction.hxx"
#include "MureConstant.hxx"
Functions | |
void | RotateVector (vector< double > &V, double phi, double theta, double psi) |
Rotate a Vector clockwise. ??? why a shape member? | |
void | RotatePoint (double *P, double phi, double theta, double psi, double *center) |
Rotate a Point clockwise.??? why a shape member? | |
void | RotatePoint (vector< double > &P, double phi, double theta, double psi, double *center) |
Rotate a Point clockwise.??? why a shape member? | |
double | PS (vector< double > U, vector< double >V) |
Scalar product of 3D vectors U and V. | |
string | wordwrap (string x, int w) |
word-wrap a string | |
string | __macro_method_name__ (string x) |
this is for METHOD_NAME macro, extracting method name from PRETTY_FUNCTION | |
void | Regression (int N, const vector< double > &x, const vector< double > &y, const vector< double > &y_sdev, double &A, double &B, double &A_sdev, double &B_sdev, double &chi2) |
Linear Regression function. | |
void | FindFitParameters (int N, const vector< double > &x, const vector< double > &y, const vector< double > &y_sdev, double &A, double &B) |
Find Slope and Intersept of fit. | |
double | CylVol (double Radius, double Height) |
double | OnionRingVol (double Radius_a, double Radius_i, double Height) |
double | OnionRingVol (double Radius_a, double Radius_i, double Height_a, double Height_i) |
Methods for linear regression and auxiliaries for error logging.
string __macro_method_name__ | ( | string | x | ) |
this is for METHOD_NAME macro, extracting method name from PRETTY_FUNCTION
double CylVol | ( | double | Radius, |
double | Height | ||
) |
void FindFitParameters | ( | int | N, |
const vector< double > & | x, | ||
const vector< double > & | y, | ||
const vector< double > & | y_sdev, | ||
double & | A, | ||
double & | B | ||
) |
Find Slope and Intersept of fit.
The method uses the Regression function.
N | : Number of point to use for the regression |
x | : vector of X axis (only the N first are taken into account) |
y | : vector of Y axis value (only the N first are taken into account) |
y_sdev | : vector of Y axis error value (only the N first are taken into account). if size=0 no weights are used |
A | : the slope of the regression |
B | : the intersept of the regression |
double OnionRingVol | ( | double | Radius_a, |
double | Radius_i, | ||
double | Height | ||
) |
double OnionRingVol | ( | double | Radius_a, |
double | Radius_i, | ||
double | Height_a, | ||
double | Height_i | ||
) |
double PS | ( | vector< double > | U, |
vector< double > | V | ||
) |
Scalar product of 3D vectors U and V.
void Regression | ( | int | N, |
const vector< double > & | x, | ||
const vector< double > & | y, | ||
const vector< double > & | y_sdev, | ||
double & | A, | ||
double & | B, | ||
double & | A_sdev, | ||
double & | B_sdev, | ||
double & | chi2 | ||
) |
Linear Regression function.
The method is taken from Numerical Recipes and converted in C++ form.
N | : Number of point to use for the regression |
x | : vector of X axis (only the N first are taken into account) |
y | : vector of Y axis value (only the N first are taken into account) |
y_sdev | : vector of Y axis error value (only the N first are taken into account). if size=0 no weights are used |
A | : the slope of the regression |
B | : the intersept of the regression |
A_sdev | : the slope error of the regression |
B_sdev | : the slope intersept of the regression |
chi2 | the chi square |
void RotatePoint | ( | double * | P, |
double | phi, | ||
double | theta = 0 , |
||
double | psi = 0 , |
||
double * | center = nullptr |
||
) |
Rotate a Point clockwise.??? why a shape member?
P | : 3D point |
phi | : angle around z axis |
theta | : angle around y axis |
psi | : arround x axis |
center | : the center of rotation (Default=origin) |
void RotatePoint | ( | vector< double > & | P, |
double | phi, | ||
double | theta = 0 , |
||
double | psi = 0 , |
||
double * | center = nullptr |
||
) |
Rotate a Point clockwise.??? why a shape member?
P | : 3D point |
phi | : angle around z axis |
theta | : angle around y axis |
psi | : arround x axis |
center | : the center of rotation (Default=origin) |
void RotateVector | ( | vector< double > & | V, |
double | phi, | ||
double | theta = 0 , |
||
double | psi = 0 |
||
) |
Rotate a Vector clockwise. ??? why a shape member?
V | : 3D vector |
phi | : arround z axis |
theta | : arround y axis |
psi | : arround x axis |
string wordwrap | ( | string | x, |
int | w | ||
) |
word-wrap a string
x | : String to be wrapped |
w | : Maximum width |