35 template <
class RealType>
39 const auto nReal =
static_cast<RealType
>(n);
40 const auto piSqrt = std::sqrt(
M_PI);
41 const auto divisor = std::tgamma(nReal / 2.0 + 1.0);
42 return std::pow(piSqrt, nReal) / divisor;
51 template <
class RealType>
55 const auto nReal =
static_cast<RealType
>(n);
56 const auto piSqrt = std::sqrt(
M_PI);
57 const auto divisor = std::tgamma(nReal / 2.0 + 1.0);
58 return std::pow(piSqrt * radius, nReal) / divisor;
67 template <
class RealType,
class IteratorType>
71 const auto nReal =
static_cast<RealType
>(std::distance(beginRadii, endRadii));
72 const auto divisor = std::tgamma(nReal / 2.0 + 1.0);
73 auto dividend = std::pow(std::sqrt(
M_PI), nReal);
75 for (; beginRadii != endRadii; ++beginRadii)
77 dividend *= *beginRadii;
80 return dividend / divisor;
92 template <
class RealType>
96 const auto nReal =
static_cast<RealType
>(n);
97 const auto divisor = std::tgamma(nReal / 2.0 + 1.0);
98 const auto piSqrt = std::sqrt(
M_PI);
99 return std::pow(piSqrt, nReal) * std::pow(equatorialRadius, nReal - 1.0) * polarRadius /
This file offers overloads of toIce() and fromIce() functions for STL container types.
RealType volumeOfUnitHypersphere(std::size_t n)
Returns the volume of a n dimensional unit hypersphere.
RealType volumeOfHyperellipsoid(IteratorType beginRadii, IteratorType endRadii)
Returns the volume of an hyperellipsoid with the radii contained by the range [beginRadii,...
RealType volumeOfHypersphere(std::size_t n, RealType radius)
Returns the volume of a n dimensional hypersphere with radius radius.
RealType volumeOfHyperspheroid(std::size_t n, RealType polarRadius, RealType equatorialRadius)
Returns the volume of a hyperspheroid with given dimensionality and radii.