npstat
is hosted by
Hepforge
,
IPPP Durham
Home
Subversion
Tracker
Wiki
NPStat
5.10.0
rng
convertToSphericalRandom.hh
Go to the documentation of this file.
1
#ifndef NPSTAT_CONVERTTOSPHERICALRANDOM_HH_
2
#define NPSTAT_CONVERTTOSPHERICALRANDOM_HH_
3
4
/*!
5
// \file convertToSphericalRandom.hh
6
//
7
// \brief Random numbers on the surface of N-dimensional unit sphere
8
//
9
// Author: I. Volobouev
10
//
11
// March 2010
12
*/
13
14
namespace
npstat
{
15
/**
16
// This function converts an N-dimensional random number set from
17
// a unit hypercube into a random direction in the N-dim space and
18
// a random number between 0 and 1 which can be later used to generate
19
// the distance from the origin.
20
//
21
// The method implementation depends crucially on the numerical
22
// accuracies of the "inverseGaussCdf" and "incompleteGamma" special
23
// functions (it is likely that both can be improved, especially the
24
// latter).
25
//
26
// The function returns the "remaining" random number.
27
// The "direction" array which must have at least "dim"
28
// elements is filled with the random direction vector
29
// of unit length.
30
//
31
// If "getRadialRandom" argument is set to "false", the
32
// radial random number is not generated and -1 is returned.
33
// Use this to increase the code speed if only the random
34
// direction itself is needed.
35
*/
36
double
convertToSphericalRandom
(
const
double
* rnd,
unsigned
dim,
37
double
* direction,
38
bool
getRadialRandom=
true
);
39
}
40
41
#endif
// NPSTAT_CONVERTTOSPHERICALRANDOM_HH_
npstat
Definition:
AbsArrayProjector.hh:14
npstat::convertToSphericalRandom
double convertToSphericalRandom(const double *rnd, unsigned dim, double *direction, bool getRadialRandom=true)
Generated by
1.9.1