#include <string>
#include <vector>
#include <iostream>
#include "math_types.h"
Go to the source code of this file.
Function Documentation
double bessi0 |
( |
double |
x |
) |
|
Compute the Modified Bessel function of order 0.
- Parameters:
-
- Returns:
- The function value of the modified Bessel function of order 0.
template<class T >
T find_max |
( |
const std::vector< T > & |
vec |
) |
[inline] |
Find the maximal value of a std::vector.
- Parameters:
-
[in] | vec | A std::vector of comparable elements. |
- Returns:
- The largest value.
template<class T >
int find_max_idx |
( |
const std::vector< T > & |
vec |
) |
[inline] |
Find the maximal entry of a std::vector.
- Parameters:
-
[in] | vec | A std::vector of comparable elements. |
- Returns:
- The index of the value with the largest value.
template<class T >
T force_in_range |
( |
const T & |
val, |
|
|
const T & |
min_val, |
|
|
const T & |
max_val | |
|
) |
| | [inline] |
Force a real number into an interval.
- Parameters:
-
[in] | val | Any real number. |
[in] | min_val | The smallest value in the interval. |
[in] | max_val | The largest value in the interval. |
- Returns:
- The number nearest to val the is larger or equal to min_val and smaller or equal to max_val.
Create a valid file name from the name of the file and the name of the directory containing the file. The function simply concatenates the arguments, while putting a platform specific path seperator between them.
- Parameters:
-
[in] | dir | The name of a directory. |
[in] | filename | The name of a file. |
- Returns:
- A string containing the directory followed by a path seperator followed by the name of the file.
Create a valid file name from the name of the file and the name of the directory containing the file. The function simply concatenates the arguments, while putting a platform specific path seperator between them.
- Parameters:
-
[in] | dir1 | The name of a directory. |
[in] | dir2 | The name of a directory. |
[in] | filename | The name of a file. |
- Returns:
- A string containing the first directory followed by a path seperator followed the second directory followed by a path seperator and the name of the file.
The Hot colour map ranging form black to white.
- Parameters:
-
[in] | x | A real number between 0 and 1. |
- Returns:
- A 3-vector containing RGB values corresponding to the input.
The Jet colour map ranging form blue to red.
- Parameters:
-
[in] | x | A real number between 0 and 1. |
- Returns:
- A 3-vector containing RGB values corresponding to the input.
double mod_2pi |
( |
const double |
dx |
) |
[inline] |
Compute the value of a number modulo two pi.
- Parameters:
-
- Returns:
- The input modulo two pi.
double mod_pi |
( |
const double |
dx |
) |
[inline] |
Compute the value of a number modulo pi.
- Parameters:
-
- Returns:
- The input modulo pi.
template<class T >
double norm |
( |
const T & |
a |
) |
[inline] |
Compute the two-norm of a vector.
- Parameters:
-
- Returns:
- The norm of the input.
template<class T >
double norm2 |
( |
const T & |
a |
) |
[inline] |
Compute the square two-norm of a vector.
- Parameters:
-
- Returns:
- The dot product of the vector with itself (i.e. the square of its norm).
Path seperator on various platforms. On Microsoft Windoes it is \, while it is / on other platforms. This is helpful when doing file IO in a platform independent manor.
Project a 3D point onto a 3D line.
- Parameters:
-
[in] | p | The 3D point to be projected onto a line. |
[in] | l1 | One point on the line. |
[in] | l2 | Another point on the line (different from l1) |
- Returns:
- The projection of p into the line spanned by l1 and l2.
template<class T >
T sign |
( |
const T & |
a |
) |
[inline] |
Compute the sign of a number.
- Parameters:
-
- Returns:
- If a is negative return -1, +1 or a is positive and 0 if a is 0.
template<class T >
T square |
( |
const T & |
a |
) |
[inline] |
Compute the square of a number.
- Parameters:
-
- Returns:
- The number multiplied by itself.