499 inline std::vector<std::string>
DimNames () {
return {
"1D",
"2D"}; }
524 inline std::vector<std::string>
BinTypeNames () {
return {
"linear",
"logarithmic"}; }
548 inline std::vector<BinType>
BinTypeCast (
const std::vector<int> binTypeIndeces) {
return castFromValues<BinType>(binTypeIndeces); }
556 inline std::vector<BinType>
BinTypeCast (
const std::vector<std::string> binTypeNames) {
return castFromNames<BinType>(binTypeNames,
BinTypeNames()); }
585 inline std::vector<std::string>
CoordinateUnitsNames () {
return {
"radians",
"degrees",
"arcseconds",
"arcminutes"}; }
609 inline std::vector<CoordinateUnits>
CoordinateUnitsCast (
const std::vector<int> coordinateUnitsIndeces) {
return castFromValues<CoordinateUnits>(coordinateUnitsIndeces); }
664 inline std::vector<CoordinateType>
CoordinateTypeCast (
const std::vector<int> coordinateTypeIndeces) {
return castFromValues<CoordinateType>(coordinateTypeIndeces); }
674 struct comovingCoordinates {
double xx;
double yy;
double zz; };
675 struct observedCoordinates {
double ra;
double dec;
double redshift; };
684 typedef Eigen::Matrix<std::complex<double>, 1, Eigen::Dynamic>
VectorComplex;
708 typedef std::vector<std::vector<std::vector<int>>>
Tensor3Di;
711 typedef std::vector<std::vector<std::vector<double>>>
Tensor3Dd;
714 typedef std::vector<std::vector<std::vector<std::vector<int>>>>
Tensor4Di;
734 #define coutCBL std::cout << headerCBL
747 inline void WarningMsgCBL (
const std::string msg,
const std::string functionCBL,
const std::string fileCBL)
791 inline void Beep (
const std::string beep=
"beep")
792 {
if (system((
"command -v say >/dev/null && { say "+beep+
"; }").c_str())) {} }
803 inline bool isSet (
const std::string var)
836 inline bool isSet (
const double var)
848 inline bool isSet (
const std::vector<double> vect)
852 while (is && ind<vect.size())
866 inline bool isSet (
const std::vector<unsigned int> vect)
870 while (is && ind<vect.size())
884 inline bool isSet (
const std::vector<std::vector<unsigned int>> vect)
889 while (is && i<vect.size()) {
890 while (is && ind<vect[i].size())
903 template <
typename T> std::string
conv (
const T val,
const char *fact)
905 char VAL[20]; sprintf(VAL, fact, val);
906 return std::string(VAL);
914 template <
typename T>
916 {
return (val<0) ? val-0.5 : val+0.5; }
925 template <
typename T>
926 T
Log (
const T val,
const double fact=0.9)
936 template <
typename T>
937 T
Ln (
const T val,
const double fact=0.9)
947 template <
typename T>
950 if (a>b)
ErrorCBL(
"the input parameter a must be <= than the input parameter b!",
"closest",
"Kernel.h");
951 else if (a==b)
return a;
952 else return (fabs(x-a) < fabs(x-b)) ? a : b;
964 template <
typename T>
967 if (vv.size()==0)
ErrorCBL(
"vv is an empty std::vector!",
"index_closest",
"Kernel.h");
968 std::vector<double>::iterator low, up;
969 low = lower_bound(vv.begin(), vv.end(), x);
970 up = upper_bound(vv.begin(), vv.end(), x);
971 int index = (
closest(x, *low, *up)==*low) ? low-vv.begin() : up-vv.begin();
983 template <
typename T>
1006 long long LongSwap (
const long long i);
1053 void checkIO (
const std::ifstream &fin,
const std::string file=
"NULL");
1060 void checkIO (
const std::ofstream &fout,
const std::string file=
"NULL");
1109 int check_memory (
const double frac,
const bool exit=
true,
const std::string func=
"",
const int type=1);
1141 template <
typename T>
1142 void Print (
const T value,
const int prec,
const int ww,
const std::string header=
"",
const std::string end=
"\n",
const bool use_coutCBL=
true, std::ostream &stream=std::cout,
const std::string colour=
cbl::par::col_default)
1144 const int bp = std::cout.precision();
1145 if (fabs(value)<pow(10, -prec) || fabs(value)>pow(10, prec)) {
1147 coutCBL << header << colour << std::scientific << std::setprecision(prec) << std::setw(ww) << std::right << value <<
par::col_default << end;
1149 stream << header << std::scientific << std::setprecision(prec) << std::setw(ww) << std::right << value << end;
1153 coutCBL << header << colour << std::fixed << std::setprecision(prec) << std::setw(ww) << std::right << value <<
par::col_default << end;
1155 stream << header << std::fixed << std::setprecision(prec) << std::setw(ww) << std::right << value << end;
1157 std::cout.precision(bp);
1168 template <
typename T>
1169 void Print (
const std::vector<T> vect,
const int prec=4,
const int ww=8)
1171 for (
auto &&vi : vect)
1172 Print(vi, prec, ww);
1181 inline void Print (
const std::vector<std::string> vect)
1183 for (
auto &&vi : vect)
1197 template <
typename T>
1198 void Print (
const std::vector<T> vect1,
const std::vector<T> vect2,
const int prec=4,
const int ww=8)
1200 if (vect1.size()!=vect2.size())
1201 ErrorCBL(
"the two input vectors to be printed must have the same dimension!",
"Print",
"Kernel.h");
1203 for (
size_t i=0; i<vect1.size(); i++) {
1204 Print(vect1[i], prec, ww,
"",
" ");
1205 Print(vect2[i], prec, ww);
1218 inline void Print (
const std::vector<std::string> vect1,
const std::vector<std::string> vect2)
1220 if (vect1.size()!=vect2.size())
1221 ErrorCBL(
"the two input vectors to be printed must have the same dimension!",
"Print",
"Kernel.h");
1223 for (
size_t i=0; i<vect1.size(); i++)
1224 coutCBL << vect1[i] <<
" " << vect2[i] << std::endl;
1242 template <
typename T>
1243 void Print (
const std::vector<T> vect1,
const std::vector<T> vect2,
const std::vector<T> vect3,
const int prec=4,
const int ww=8)
1245 if (vect1.size()!=vect2.size() || vect1.size()!=vect3.size())
1246 ErrorCBL(
"the three input vectors to be printed must have the same dimension!",
"Print",
"Kernel.h");
1248 for (
size_t i=0; i<vect1.size(); i++) {
1249 Print(vect1[i], prec, ww,
"",
" ");
1250 Print(vect2[i], prec, ww,
"",
" ");
1251 Print(vect3[i], prec, ww);
1266 inline void Print (
const std::vector<std::string> vect1,
const std::vector<std::string> vect2,
const std::vector<std::string> vect3)
1268 if (vect1.size()!=vect2.size() || vect1.size()!=vect3.size())
1269 ErrorCBL(
"the three input vectors to be printed must have the same dimension!",
"Print",
"Kernel.h");
1271 for (
size_t i=0; i<vect1.size(); i++)
1272 coutCBL << vect1[i] <<
" " << vect2[i] <<
" " << vect3[i] << std::endl;
1286 template <
typename T>
1287 void Print (
const std::vector<std::vector<T>> mat,
const int prec=4,
const int ww=8)
1289 for (
size_t i=0; i<mat.size(); i++) {
1290 for (
size_t j=0; j<mat[i].size(); j++)
1292 Print(mat[i][j], prec, ww,
"",
" ");
1294 Print(mat[i][j], prec, ww,
"",
" ");
1295 std::cout << std::endl;
1305 inline void Print (
const std::vector<std::vector<std::string>> mat)
1307 for (
size_t i=0; i<mat.size(); i++) {
1308 for (
size_t j=0; j<mat[i].size(); j++)
1312 std::cout << mat[i][j] <<
" ";
1313 std::cout << std::endl;
1323 template <
typename T>
1324 T
Min (
const std::vector<T> vect)
1326 if (vect.size()==0)
ErrorCBL(
"vect.size=0!",
"Min",
"Kernel.h");
1327 return *min_element(vect.begin(), vect.end());
1335 template <
typename T>
1336 T
Max (
const std::vector<T> vect)
1338 if (vect.size()==0)
ErrorCBL(
"vect.size=0!",
"Max",
"Kernel.h");
1339 return *max_element(vect.begin(), vect.end());
1348 template <
typename T>
1351 std::vector<T> vect = vect_input;
1352 sort(vect.begin(), vect.end());
1353 typename std::vector<T>::iterator it = unique(vect.begin(), vect.end());
1354 vect.resize(it-vect.begin());
1363 template <
typename T>
1366 std::vector<T> vect = different_elements<T>(vect_input);
1394 template <
typename T>
1395 void Erase (std::vector<T> &vv, std::vector<int> ind)
1397 for (
auto &&i : ind)
1398 if (i>=
int(vv.size()))
ErrorCBL(
"the input value of ind is too large!",
"Erase",
"Kernel.h");
1402 for (
auto &&i : ind)
1403 vv.erase(vv.begin()+i-(tt++));
1412 template <
typename T>
1413 void Erase_lines (std::vector<std::vector<T> > &Mat, std::vector<int> ll)
1416 if (i>=
int(Mat.size()))
ErrorCBL(
"the dimension of the input vector ll is too large!",
"Erase_lines",
"Kernel.h");
1421 Mat.erase(Mat.begin()+i-(tt++));
1430 template <
typename T>
1433 for (
auto &&i : col)
1434 for (
auto &&j : Mat)
1435 if (i>=
int(j.size()))
ErrorCBL(
"the dimension of the input vector col is too large!",
"Erase_columns",
"Kernel.h");
1439 for (
auto &&i : col) {
1440 for (
auto &&j : Mat)
1441 j.erase(j.begin()+i-tt);
1460 template <
typename T>
1461 void SubMatrix (std::vector<T> &xx, std::vector<T> &yy, std::vector<std::vector<T> > &Mat, T val)
1463 std::vector<int> line, column;
1465 for (
unsigned int i=0; i<xx.size(); i++) {
1466 if (i>=Mat.size())
ErrorCBL(
"the dimension of the input vector xx is too large!",
"SubMatrix",
"Kernel.h");
1469 for (
unsigned int j=0; j<yy.size(); j++) {
1470 if (j>=Mat[i].size())
ErrorCBL(
"the dimension of the input vector yy is too large!",
"SubMatrix",
"Kernel.h");
1471 if (Mat[i][j]<val) {
1472 if (j<
int(yy.size()*0.5)) {line.push_back(i); ll = 1;}
1473 else if (ll==0) {column.push_back(j);}
1492 template <
typename T>
1493 bool isDimEqual (
const std::vector<T> vect1,
const std::vector<T> vect2)
1495 return (vect1.size()==vect2.size()) ? 1 : 0;
1505 template <
typename T>
1506 bool isDimEqual (
const std::vector<std::vector<T> > mat1,
const std::vector<std::vector<T> > mat2)
1508 bool is = (mat1.size()==mat2.size()) ? 1 : 0;
1510 for (
unsigned int i=0; i<mat1.size(); i++) {
1511 if (mat1[i].size()!=mat2[i].size()) is = 0;
1531 template <
typename T>
1532 void checkDim (
const std::vector<T> vect,
const int val,
const std::string vector,
bool equal=
true)
1535 if ((
int)vect.size()!=val)
1539 if ((
int)vect.size()<val)
1555 template <
typename T>
1556 void checkDim (
const std::vector<T> mat,
const int val_i,
const int val_j,
const std::string matrix,
const bool equal=
true)
1559 if (
int(mat.size())!=val_i)
1562 for (
size_t k=0; k<mat.size(); k++)
1563 if (
int(mat[k].size())!=val_j)
1567 if (
int(mat.size())<val_i)
1570 for (
size_t k=0; k<mat.size(); k++)
1571 if (
int(mat[k].size())<val_j)
1586 template <
typename T>
1587 void checkEqual (
const std::vector<T> vect1,
const std::vector<T> vect2)
1589 checkDim(vect2, vect1.size(),
"vect2");
1590 for (
size_t i=0; i<vect1.size(); i++)
1591 if (vect1[i]!=vect2[i])
1592 ErrorCBL(
"vect1 and vect2 are different!",
"checkEqual",
"Kernel.h");
1603 template <
typename T>
1606 std::vector<T> vv(nn);
1607 for (
size_t i = 0; i<nn; i++)
1608 vv[i] = min+(max-min)*T(i)/T(nn-1);
1620 template <
typename T>
1623 std::vector<T> vv(nn);
1624 for (
size_t i=0; i<nn; i++)
1625 vv[i] = exp(log(min)+(log(max)-log(min))*T(i)/T(nn-1));
1637 template <
typename T>
1638 int locate (
const std::vector<T> &vv,
const T xx)
1640 size_t nn = vv.size ();
1643 bool as = (vv[nn-1] >= vv[0]);
1646 int jm = (ju+
jl)*0.5;
1647 if ((xx >= vv[jm]) == as)
1654 else if (xx == vv[nn-1])
1668 template <
typename T>
1672 for (
unsigned int i=0; i< index.size(); i++)
1673 vv.push_back(vec[index[i]]);
1685 template <
typename T>
1686 std::vector<T>
flatten(std::vector<std::vector<T>> matrix)
1689 for (
size_t i=0; i<matrix.size(); i++)
1690 for (
size_t j=0; j<matrix[i].size(); j++)
1691 flatten.push_back(matrix[i][j]);
1706 template <
typename T>
1707 std::vector<std::vector<T>>
reshape (std::vector<T> vec,
const int size1,
const int size2)
1709 if (size1*size2!=
int(vec.size()))
1712 std::vector<std::vector<T>> matrix(size1, std::vector<T> (size2, 0));
1714 for (
int i=0; i<size1; i++)
1715 for (
int j=0; j<size2; j++)
1716 matrix[i][j] = vec[j+i*size2];
1728 template <
typename T>
1729 std::vector<std::vector<T>>
transpose (std::vector<std::vector<T>> matrix)
1731 const int size1 = matrix.size();
1732 const int size2 = matrix[0].size();
1734 std::vector<std::vector<T>> TRmatrix(size2, std::vector<T> (size1, 0));
1736 for (
int i=0; i<size1; i++)
1737 for (
int j=0; j<size2; j++)
1738 TRmatrix[j][i] = matrix[i][j];
1758 template <
typename T>
1759 bool inRange (T value, T min, T max,
bool include_limits =
true)
1761 if (include_limits){
1762 if (value>=min && max>=value)
1766 if (value>min && max>value)
1788 template <
typename T>
1789 bool inRange (std::vector<T> value, std::vector<T> min, std::vector<T> max,
bool include_limits =
true)
1793 for (
size_t i=0; i<value.size(); i++)
1794 in_range *=
int(
inRange(value[i], min[i], max[i], include_limits));
1796 return bool(in_range);
1813 template <
typename T>
1814 bool inRange (std::vector<T> value, std::vector<std::vector<T>> ranges,
bool include_limits =
true)
1818 for (
size_t i=0; i<value.size(); i++)
1819 in_range *=
int(
inRange(value[i], ranges[i][0], ranges[i][1], include_limits));
1821 return bool(in_range);
1832 template <
typename T>
1833 T
v_M_vt (
const std::vector<T> vv,
const std::vector<std::vector<T>> MM)
1835 const int size = vv.size();
1837 std::vector<double> ivv(size, 0);
1838 for(
int i=0; i<size; i++)
1839 for(
int j=0; j<size; j++)
1840 ivv[i] += vv[j]*MM[i][j];
1843 for(
int i=0; i<size; i++)
1844 res += vv[i]*ivv[i];
1853 std::vector<double> VV;
1854 CL (std::vector<double> vv) {VV = vv;};
1857 bool operator<(
const CL &,
const CL &);
1869 void sort_2vectors (std::vector<double>::iterator p1, std::vector<double>::iterator p2,
const int dim);
1880 void sort_3vectors (std::vector<double>::iterator p1, std::vector<double>::iterator p2, std::vector<double>::iterator p3,
const int dim);
1892 void sort_4vectors (std::vector<double>::iterator p1, std::vector<double>::iterator p2, std::vector<double>::iterator p3, std::vector<double>::iterator p4,
const int dim);
1911 int makeDir (std::string path,
const std::string rootPath=
".",
const mode_t mode=0777,
const bool verbose=
false);
1922 inline std::vector<std::vector<double> >
operator * (
const std::vector<std::vector<double> > &Mat1,
const std::vector<std::vector<double> > &Mat2)
1924 std::vector<std::vector<double> > MatP(Mat1.size(), std::vector<double>(Mat2[0].size(),0.));
1926 for (
unsigned int i=0; i<Mat1.size(); i++)
1927 for (
unsigned int j=0; j<Mat2[0].size(); j++) {
1929 for (
unsigned int k=0; k<Mat1[0].size(); k++)
1930 temp += Mat1[i][k]*Mat2[k][j];
1946 template <
typename T>
1947 std::vector<T>
slice (
const std::vector<T> v,
const int start=0,
const int end=-1)
1949 int oldlen = v.size();
1952 if (end==-1 || end>=oldlen)
1953 newlen = oldlen-start;
1957 std::vector<T> nv(newlen);
1959 for (
int i=0; i<newlen; i++)
1983 std::vector<std::vector<double>>
read_file (
const std::string file_name,
const std::string path_name,
const std::vector<int> column_data,
const int skip_nlines=0);
2006 std::vector<std::vector<double>>
read_file (
const std::string file_name,
const std::string path_name,
const std::vector<int> column_data,
const std::string delimiter,
const char comment=
'#');
Constants of general use.
Classes used to cast integers and std::string into the enums used in the CosmoBolognaLib.
The class Exception Class used to handle the exceptions.
#define coutCBL
CBL print message.
The class Path used to handle the Cosmobolognalib paths.
static const std::string col_default
default colour (used when printing something on the screen)
static const std::string col_yellow
yellow colour (used when printing something on the screen)
static const std::string col_bred
bold high intensty red colour (used when printing something on the screen)
static const std::string col_blue
blue colour (used when printing something on the screen)
static const char fINT[]
conversion symbol for: int -> std::string
static const std::string defaultString
default std::string value
static const long defaultLong
default long value
static const double defaultDouble
default double value
static const int defaultInt
default integer value
static const std::string ErrorMsg
header of error messages for internal usage
Var
the catalogue variables
The global namespace of the CosmoBolognaLib
T Log(const T val, const double fact=0.9)
common logarithm (i.e. logarithm to base 10)
std::vector< std::string > CoordinateTypeNames()
return a std::vector containing the CoordinateType names
T Min(const std::vector< T > vect)
minimum element of a std::vector
CoordinateType CoordinateTypeCast(const int coordinateTypeIndex)
cast an enum of type CoordinateType from its index
int N_different_elements(const std::vector< T > vect_input)
get the number of unique elements of a std::vector
std::string conv(const T val, const char *fact)
convert a number to a std::string
void Print(const T value, const int prec, const int ww, const std::string header="", const std::string end="\n", const bool use_coutCBL=true, std::ostream &stream=std::cout, const std::string colour=cbl::par::col_default)
function to print values with a proper homegenised format
void Erase_lines(std::vector< std::vector< T > > &Mat, std::vector< int > ll)
erase some lines of a matrix
std::function< double(std::vector< double >)> FunctionDoubleVector
typedef of a function returning a double with a vector in input
std::vector< std::vector< double > > read_file(const std::string file_name, const std::string path_name, const std::vector< int > column_data, const int skip_nlines=0)
read a data from a file ASCII
std::vector< std::vector< double > > operator*(const std::vector< std::vector< double > > &Mat1, const std::vector< std::vector< double > > &Mat2)
matrix multiplication
CoordinateType
the coordinate type
@ _observed_
observed coordinates (R.A., Dec, redshift)
@ _comoving_
comoving coordinates (x, y, z)
std::ostream & headerCBL(std::ostream &stream)
provide the header for all internal messages
std::vector< T > different_elements(const std::vector< T > vect_input)
get the unique elements of a std::vector
T index_closest(T x, std::vector< T > vv)
given a number x, return the index of the closest element to x in vv
std::vector< T > slice(const std::vector< T > v, const int start=0, const int end=-1)
slice a std::vector from start to stop
void Erase_columns(std::vector< std::vector< T > > &Mat, std::vector< int > col)
erase some columns of a matrix
void Beep(const std::string beep="beep")
produce a beep
bool isSet(const std::string var)
check if the value of a [string] variable has already been set
std::vector< T > logarithmic_bin_vector(const size_t nn, const T min, const T max)
fill a std::vector with logarithmically spaced values
std::vector< T > linear_bin_vector(const size_t nn, const T min, const T max)
fill a std::vector with linearly spaced values
void checkDim(const std::vector< T > vect, const int val, const std::string vector, bool equal=true)
check if the dimension of a std::vector is equal/lower than an input value
void checkIO(const std::ifstream &fin, const std::string file="NULL")
check if an input file can be opened
void sort_4vectors(std::vector< double >::iterator p1, std::vector< double >::iterator p2, std::vector< double >::iterator p3, std::vector< double >::iterator p4, const int dim)
sort the elements of a std::vectors, and the elements of three other std::vectors according to the fi...
int locate(const std::vector< T > &vv, const T xx)
locate a value in a given std::vector
std::function< std::vector< double >std::vector< double >, std::shared_ptr< void >, std::vector< double > &)> FunctionVectorVectorPtrVectorRef
typedef of a function returning a vector with a vector, a pointer and a vector reference in input
int used_memory(const int type)
get the memory used by current process in kB
int ErrorCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib
void unique_unsorted(std::vector< int > &vv)
erase all the equal elements of the input std::vector
void set_EnvVar(const std::vector< std::string > Var)
set evironment variables
short ShortSwap(const short s)
endian conversion of a short variable
T closest(T x, T a, T b)
given a number x, return the closest of two values a, b
std::vector< std::vector< std::vector< double > > > Tensor3Dd
typedef of a 3D Tensor of double
std::vector< T > flatten(std::vector< std::vector< T >> matrix)
flatten a matrix in a vector of size
std::vector< std::string > DimNames()
return a vector containing the Dim names
std::function< double(double, double, std::shared_ptr< void >, std::vector< double > &)> FunctionDoubleDoubleDoublePtrVectorRef
typedef of a function returning a double with two double, a pointer and a vector reference in input
T v_M_vt(const std::vector< T > vv, const std::vector< std::vector< T >> MM)
return the value of
CoordinateUnits CoordinateUnitsCast(const int coordinateUnitsIndex)
cast an enum of type CoordinateUnits from its index
std::vector< std::vector< std::vector< int > > > Tensor3Di
typedef of a 3D Tensor of int
Eigen::Matrix< std::complex< double >, 1, Eigen::Dynamic > VectorComplex
Eigen complex std::vector.
T Max(const std::vector< T > vect)
maximum element of a std::vector
bool inRange(T value, T min, T max, bool include_limits=true)
return false value outside the range; true value inside the range
std::function< double(double)> FunctionDoubleDouble
typedef of a function returning a double with a double in input
BinType BinTypeCast(const int binTypeIndex)
cast an enum of type BinType from its index
bool isDimEqual(const std::vector< T > vect1, const std::vector< T > vect2)
check if the dimensions of two std::vectors are equal
T Ln(const T val, const double fact=0.9)
natural logarithm
std::vector< std::vector< T > > transpose(std::vector< std::vector< T >> matrix)
transpose a matrix
std::vector< std::vector< T > > reshape(std::vector< T > vec, const int size1, const int size2)
reshape a vector into a matrix of given number of rows and columns
double round_to_digits(const double num, const int ndigits)
reduce the digit figures of an input double
double DoubleSwap(const double d)
endian conversion of a double variable
std::vector< std::string > BinTypeNames()
return a vector containing the BinType names
int Error(const std::string msg, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_, const std::string header="\n")
throw an exception
std::vector< std::string > CoordinateUnitsNames()
return a std::vector containing the CoordinateUnits names
void Erase(std::vector< T > &vv, std::vector< int > ind)
erase some elements of a std::vector
std::function< double(double, std::shared_ptr< void >, std::vector< double > &)> FunctionDoubleDoublePtrVectorRef
typedef of a function returning a double with a double, a pointer and a vector reference in input
std::function< double(std::vector< double > &)> FunctionDoubleVectorRef
typedef of a function returning a double with a vector reference in input
void checkEqual(const std::vector< T > vect1, const std::vector< T > vect2)
check if two std::vectors are equal
int nint(const T val)
the nearest integer
void sort_2vectors(std::vector< double >::iterator p1, std::vector< double >::iterator p2, const int dim)
sort the elements of a std::vectors, and the elements of a second std::vector according to the first ...
CoordinateUnits
the coordinate units
@ _radians_
angle in radians
@ _arcminutes_
angle in arcminutes
@ _arcseconds_
angle in arcseconds
@ _degrees_
angle in degrees
@ _logarithmic_
logarithmic binning
void WarningMsgCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL)
internal CBL warning message
long long LongSwap(const long long i)
endian conversion of a long integer variable
int check_memory(const double frac, const bool exit=true, const std::string func="", const int type=1)
check if the memory used by current process is larger than a given fraction of the available memory
std::function< double(std::vector< double >, std::shared_ptr< void >, std::vector< double > &)> FunctionDoubleVectorPtrVectorRef
typedef of a function returning a double with a vector, a pointer and a vector reference in input
void check_EnvVar(const std::string Var)
check if an environment variable exists
float FloatSwap(const float f)
endian conversion of a float variable
double round_to_precision(const double num, const int ndigits)
reduce the precision of an input double
int makeDir(std::string path, const std::string rootPath=".", const mode_t mode=0777, const bool verbose=false)
function to create multiple directories
Dim
the dimension, used e.g. for pair and triplet vectors
@ _2D_
2D pair, used e.g. for 2D pairs, in Cartesian or polar coordinates
@ _1D_
1D, used e.g. for 1D pairs, in angular or comoving separations
std::vector< T > extract_elements(std::vector< T > vec, std::vector< unsigned int > index)
extract elements from a given vector
double jl(const double xx, const int order)
the order l spherical Bessel function
void SubMatrix(std::vector< T > &xx, std::vector< T > &yy, std::vector< std::vector< T > > &Mat, T val)
select a submatrix containing lines and columns with all elements major than val
std::vector< std::vector< std::vector< std::vector< int > > > > Tensor4Di
typedef of a 4D Tensor of int
void sort_3vectors(std::vector< double >::iterator p1, std::vector< double >::iterator p2, std::vector< double >::iterator p3, const int dim)
sort the elements of a std::vectors, and the elements of two other std::vectors according to the firs...
Eigen::Matrix< double, 4, 1 > Vector4D
Eigen 4D matrix.
int IntSwap(const int i)
endian conversion of an integer variable
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen 3D std::vector.