|
INET Framework for OMNeT++/OMNEST
|
Support functions for mathematical operations. More...
Namespaces | |
| internal | |
Classes | |
| class | AddedFunction |
| class | ApproximatedFunction |
| Approximates the values and partitioning of a multidimensional function along one of the dimensions. More... | |
| class | AverageInterpolator |
| class | BilinearFunction |
| Linear in two dimensions and constant in the others. More... | |
| class | Boxcar1DFunction |
| Some constant value r between lower and upper and zero otherwise. More... | |
| class | Boxcar2DFunction |
| Some constant value r between (lowerX, lowerY) and (upperX, upperY) and zero otherwise. More... | |
| class | CloserInterpolator |
| class | Combined2DFunction |
| Combines 2 one-dimensional functions into a two-dimensional function. More... | |
| class | ConstantFunction |
| class | ConstantInterpolatorBase |
| class | DividedFunction |
| class | Domain |
| This class represents the domain of a mathematical function. More... | |
| class | DomainLimitedFunction |
| Limits the domain of a multidimensional function. More... | |
| class | DomainModulated2DFunction |
| Modulates the domain of a two-dimensional function with the values of a one-dimensional function. More... | |
| class | DomainShiftedFunction |
| Shifts the domain of a multidimensional function. More... | |
| class | EitherInterpolator |
| Interpolation that can only be used if y1 == y2. More... | |
| class | Extruded2DFunction |
| Extrudes a one-dimensional function into a two-dimensional function. More... | |
| class | FunctionBase |
| Useful base class for most IFunction implementations with some default behavior. More... | |
| class | FunctionChecker |
| Verifies that partitioning on a domain is correct in the sense that the original function and the function over the partition return the same values at the corners and center of the subdomain. More... | |
| class | GaussFunction |
| The one-dimensional Gauss function. More... | |
| class | IFunction |
| This interface represents a mathematical function from domain D to range R. More... | |
| class | IInterpolator |
| This interface represents interpolation of values (y) between two points x1 and x2. More... | |
| class | IntegratedFunction |
| class | IntegratedFunction< R, Domain< X, Y >, DIMS, RI, Domain< X > > |
| Integrates a multidimensional function in one of the dimensions producing a function with one less number of dimensions. More... | |
| class | Interpolated1DFunction |
| One-dimensional interpolated (e.g. More... | |
| class | InterpolatorBase |
| class | Interval |
| N-dimensional interval (cuboid), given by its two opposite corners. More... | |
| class | LeftCurryingFunction |
| Fixes the parameters of a function from the left. More... | |
| class | LeftInterpolator |
| class | LineardbInterpolator |
| class | LinearInterpolator |
| class | MaximumInterpolator |
| class | MemoizedFunction |
| Truncates the values of a multidimensional function outside the given domain to 0. More... | |
| class | MinimumInterpolator |
| class | MultipliedFunction |
| class | PeriodicallyInterpolated1DFunction |
| One-dimensional interpolated (e.g. More... | |
| class | PeriodicallyInterpolated2DFunction |
| class | Point |
| N-dimensional point. More... | |
| class | Rasterized2DFunction |
| Rasterizes a function into a grid where each cell is a constant value with the mean of the original function. More... | |
| class | RightCurryingFunction |
| Fixes the parameters of a function from the right. More... | |
| class | RightInterpolator |
| class | SawtoothFunction |
| One-dimensional periodic function with a sawtooth shape. More... | |
| class | SubtractedFunction |
| class | SummedFunction |
| class | UnilinearFunction |
| Linear in one dimension and constant in the others. More... | |
| class | UnireciprocalFunction |
| Reciprocal in a given dimension and constant in the others. More... | |
Functions | |
| double | mod (double dividend, double divisor) |
| Returns the rest of a whole-numbered division. More... | |
| double | div (double dividend, double divisor) |
| Returns the result of a whole-numbered division. More... | |
| double | modulo (double a, double n) |
| Returns the remainder r on division of dividend a by divisor n, using floored division. More... | |
| bool | close (double one, double two) |
| Tests whether two doubles are close enough to be declared equal. More... | |
| int | stepfunction (double i) |
| Returns 0 if i is close to 0, 1 if i is positive and greater than epsilon, or -1 if it is negative and less than epsilon. More... | |
| double | step (double a, double b) |
| double | clamp (double v, double l, double u) |
| int | sign (double v) |
| Returns 1 if the parameter is greater than zero, -1 if less than zero, 0 otherwise. More... | |
| int | round (double d) |
| Returns an integer that corresponds to rounded double parameter. More... | |
| double | floorToZero (double d) |
| Discards the fractional part of the parameter, e.g. More... | |
| double | dB2fraction (double dB) |
| Converts a dB value to fraction. More... | |
| double | fraction2dB (double fraction) |
| Convert a fraction value to dB. More... | |
| double | dBmW2mW (double dBm) |
| Converts a dBmW value to mW. More... | |
| double | mW2dBmW (double mW) |
| Convert a mW value to dBmW. More... | |
| double | dBmWpMHz2WpHz (double dBmWpMHz) |
| Converts a dBmW/MHz value into W/Hz. More... | |
| double | wpHz2dBmWpMHz (double wpHz) |
| Convert a W/Hz value to dBmW/MHz. More... | |
| double | deg2rad (double deg) |
| Convert a degree value to radian. More... | |
| double | rad2deg (double rad) |
| Convert a radian value to degree. More... | |
| double | n_choose_k (int n, int k) |
| Implementation of the n choose k (binomial coefficient) function, from the MiXiM Framework Author Karl Wessel. More... | |
| template<typename T > | |
| const T | minnan (const T &a, const T &b) |
| This function properly and symmetrically handles NaNs in contrast with std::min and std::fmin. More... | |
| template<typename T > | |
| const T | maxnan (const T &a, const T &b) |
| This function properly and symmetrically handles NaNs in contrast with std::max and std::fmax. More... | |
| template<typename R , typename D > | |
| Ptr< const DomainLimitedFunction< R, D > > | makeFirstQuadrantLimitedFunction (const Ptr< const IFunction< R, D >> &f) |
| template<typename R , typename D , int DIMS, typename RI , typename DI > | |
| Ptr< const IFunction< RI, DI > > | integrate (const Ptr< const IFunction< R, D >> &f) |
| template<typename... T> | |
| std::ostream & | operator<< (std::ostream &os, const Domain< T ... > &d) |
| template<typename R , typename... T> | |
| std::ostream & | operator<< (std::ostream &os, const IFunction< R, Domain< T ... >> &f) |
| template<typename X , typename Y > | |
| const IInterpolator< X, Y > * | createInterpolator (const char *text) |
| void | iterateCorners (const Interval<> &i, const std::function< void(const Point<> &)> f) |
| template<typename T0 , typename... TS> | |
| void | iterateCorners (const Interval< T0, TS ... > &i, const std::function< void(const Point< T0, TS ... > &)> f) |
| template<typename... T> | |
| std::ostream & | operator<< (std::ostream &os, const Interval< T ... > &i) |
| template<typename T > | |
| void | printUnit (std::ostream &os, T v) |
| template<> | |
| void | printUnit (std::ostream &os, double v) |
| template<> | |
| void | printUnit (std::ostream &os, simtime_t v) |
| template<> | |
| void | printUnit (std::ostream &os, Quaternion v) |
| template<typename T > | |
| double | toDouble (const T v) |
| template<> | |
| double | toDouble (const simsec v) |
| template<> | |
| double | toDouble (const double v) |
| template<> | |
| double | toDouble (const simtime_t v) |
| template<typename T > | |
| T | getLowerBound () |
| template<> | |
| simsec | getLowerBound () |
| template<typename T > | |
| T | getUpperBound () |
| template<> | |
| simsec | getUpperBound () |
| template<typename T , typename... TS> | |
| T | head (const Point< T, TS ... > &p) |
| Returns the first coordinate of p. More... | |
| template<typename T , typename... TS> | |
| Point< TS ... > | tail (const Point< T, TS ... > &p) |
| Returns all but the first coordinate of p. More... | |
| template<typename... TS1, typename... TS2> | |
| Point< TS1 ..., TS2 ... > | concat (const Point< TS1 ... > &p1, const Point< TS2 ... > &p2) |
| Returns a point by concatenating the coordinates of p1 and p2. More... | |
| template<typename T0 > | |
| std::ostream & | operator<< (std::ostream &os, const Point< T0 > &p) |
| template<typename... T> | |
| std::ostream & | operator<< (std::ostream &os, const Point< T ... > &p) |
| template<typename R , typename D > | |
| void | simplifyAndCall (const typename D::I &i, const IFunction< R, D > *f, const std::function< void(const typename D::I &, const IFunction< R, D > *)> callback) |
| template<typename R , typename D > | |
| void | simplifyAndCall (const typename D::I &i, const UnilinearFunction< R, D > *f, const std::function< void(const typename D::I &, const IFunction< R, D > *)> callback) |
| template<typename R , typename D > | |
| void | simplifyAndCall (const typename D::I &i, const BilinearFunction< R, D > *f, const std::function< void(const typename D::I &, const IFunction< R, D > *)> callback) |
Variables | |
| template<typename R , typename D , int DIMS, typename RI , typename DI > | |
| class INET_API | IntegratedFunction |
| template<typename R , typename D > | |
| class INET_API | ConstantFunction |
| template<typename R , typename D > | |
| class INET_API | AddedFunction |
| template<typename R , typename D > | |
| class INET_API | SubtractedFunction |
| template<typename R , typename D > | |
| class INET_API | MultipliedFunction |
| template<typename R , typename D > | |
| class INET_API | DividedFunction |
Support functions for mathematical operations.
This namespace contains all kind of mathematical support functions
|
inline |
Referenced by inet::Coord::clamp().
|
inline |
Tests whether two doubles are close enough to be declared equal.
Returns true if parameters are at most epsilon apart, false otherwise
Referenced by inet::PostureTransition::isMarkovian(), inet::RotationMatrix::RotationMatrix(), stepfunction(), and inet::NetworkNamespaceContext::~NetworkNamespaceContext().
| Point<TS1 ..., TS2 ...> inet::math::concat | ( | const Point< TS1 ... > & | p1, |
| const Point< TS2 ... > & | p2 | ||
| ) |
Returns a point by concatenating the coordinates of p1 and p2.
Referenced by inet::math::LeftCurryingFunction< R, C, DIMSC, D, DIMSD, E >::getValue(), inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >::getValue(), iterateCorners(), inet::math::LeftCurryingFunction< R, C, DIMSC, D, DIMSD, E >::partition(), and inet::math::RightCurryingFunction< R, C, DIMSC, D, DIMSD, E >::partition().
| const IInterpolator<X, Y>* inet::math::createInterpolator | ( | const char * | text | ) |
|
inline |
Converts a dB value to fraction.
Referenced by inet::physicallayer::AxiallySymmetricAntenna::AntennaGain::AntennaGain(), inet::physicallayer::ParabolicAntenna::AntennaGain::computeGain(), inet::physicallayer::MediumLimitCache::computeMaxAntennaGain(), inet::physicallayer::UwbIrStochasticPathLoss::getGhassemzadehPathLoss(), inet::math::LineardbInterpolator< X, Y >::getMean(), inet::math::LineardbInterpolator< X, Y >::getValue(), inet::physicallayer::ConstantGainAntenna::initialize(), inet::physicallayer::CosineAntenna::initialize(), inet::physicallayer::BreakpointPathLoss::initialize(), inet::physicallayer::SnirReceiverBase::initialize(), inet::physicallayer::ParabolicAntenna::initialize(), inet::physicallayer::AxiallySymmetricAntenna::initialize(), inet::physicallayer::ErrorModelBase::initialize(), inet::physicallayer::DimensionalTransmitterBase::parseGains(), and inet::physicallayer::InterpolatingAntenna::AntennaGain::parseMap().
|
inline |
Converts a dBmW value to mW.
Referenced by inet::physicallayer::MediumLimitCache::computeMinInterferencePower(), inet::physicallayer::MediumLimitCache::computeMinReceptionPower(), inet::physicallayer::IsotropicScalarBackgroundNoise::initialize(), inet::physicallayer::DimensionalBackgroundNoise::initialize(), inet::physicallayer::IsotropicDimensionalBackgroundNoise::initialize(), inet::physicallayer::Ieee802154NarrowbandDimensionalReceiver::initialize(), inet::physicallayer::Ieee802154NarrowbandScalarReceiver::initialize(), inet::physicallayer::FlatReceiverBase::initialize(), inet::physicallayer::ApskLayeredReceiver::initialize(), and inet::physicallayer::Ieee80211LayeredOfdmReceiver::initialize().
|
inline |
Converts a dBmW/MHz value into W/Hz.
Referenced by inet::physicallayer::IsotropicDimensionalBackgroundNoise::initialize().
|
inline |
Convert a degree value to radian.
Referenced by inet::physicallayer::CosineAntenna::AntennaGain::computeGain(), and inet::StationaryMobility::updateMobilityStateFromDisplayString().
|
inline |
Returns the result of a whole-numbered division.
Referenced by inet::Int128::operator%=(), and inet::Int128::operator/=().
|
inline |
|
inline |
Convert a fraction value to dB.
Referenced by inet::visualizer::TracingObstacleLossCanvasVisualizer::createObstacleLossVisualization(), inet::math::LineardbInterpolator< X, Y >::getMean(), and inet::math::LineardbInterpolator< X, Y >::getValue().
|
inline |
|
inline |
Returns the first coordinate of p.
Referenced by inet::Ipv6NeighbourCache::DefaultRouterList::begin(), inet::Ipv6NeighbourCache::DefaultRouterList::clear(), inet::Ipv6NeighbourCache::DefaultRouterList::getHead(), iterateCorners(), inet::ospfv2::Router::printAsExternalLsa(), inet::ospfv2::Ospfv2Area::printLSDB(), inet::ospfv2::Ospfv2Area::printSummaryLsa(), inet::Ipv6NeighbourCache::DefaultRouterList::remove(), and inet::Ipv6NeighbourCache::DefaultRouterList::setHead().
|
inline |
|
inline |
| Ptr<const DomainLimitedFunction<R, D> > inet::math::makeFirstQuadrantLimitedFunction | ( | const Ptr< const IFunction< R, D >> & | f | ) |
This function properly and symmetrically handles NaNs in contrast with std::max and std::fmax.
For example, the maximum of NaN and 1 must be NaN independently of the argument order. See 'Not a number' section at https://2pi.dk/2016/05/ieee-min-max
Referenced by inet::physicallayer::ParabolicAntenna::AntennaGain::computeGain(), inet::physicallayer::CosineAntenna::AntennaGain::computeGain(), inet::physicallayer::DipoleAntenna::AntennaGain::computeGain(), inet::physicallayer::AxiallySymmetricAntenna::AntennaGain::computeGain(), inet::Cuboid::computeIntersection(), inet::physicallayer::ConvolutionalCode::computeNetBitErrorRate(), inet::math::InterpolatorBase< X, Y >::getMax(), inet::math::FunctionBase< R, Domain< X > >::getMax(), inet::math::UnilinearFunction< R, D >::getMax(), inet::math::BilinearFunction< R, D >::getMax(), inet::math::UnireciprocalFunction< R, D >::getMax(), inet::math::UnilinearFunction< R, D >::getRange(), inet::math::BilinearFunction< R, D >::getRange(), inet::math::MaximumInterpolator< X, Y >::getValue(), inet::math::Interval< R >::intersectImpl(), and inet::Quaternion::toEulerAngles().
This function properly and symmetrically handles NaNs in contrast with std::min and std::fmin.
For example, the minimum of NaN and 1 must be NaN independently of the argument order. See 'Not a number' section at https://2pi.dk/2016/05/ieee-min-max
Referenced by inet::physicallayer::ParabolicAntenna::AntennaGain::computeGain(), inet::physicallayer::CosineAntenna::AntennaGain::computeGain(), inet::physicallayer::AxiallySymmetricAntenna::AntennaGain::computeGain(), inet::physicallayer::DipoleAntenna::AntennaGain::computeGain(), inet::Cuboid::computeIntersection(), inet::physicallayer::ConvolutionalCode::computeNetBitErrorRate(), inet::physicallayer::Ieee80211NistErrorModel::getFec1024QamBer(), inet::physicallayer::Ieee80211NistErrorModel::getFec16QamBer(), inet::physicallayer::Ieee80211NistErrorModel::getFec256QamBer(), inet::physicallayer::Ieee80211NistErrorModel::getFec64QamBer(), inet::physicallayer::Ieee80211NistErrorModel::getFecBpskBer(), inet::physicallayer::Ieee80211YansErrorModel::getFecBpskBer(), inet::physicallayer::Ieee80211YansErrorModel::getFecQamBer(), inet::physicallayer::Ieee80211NistErrorModel::getFecQpskBer(), inet::math::InterpolatorBase< X, Y >::getMin(), inet::math::FunctionBase< R, Domain< X > >::getMin(), inet::math::UnilinearFunction< R, D >::getMin(), inet::math::BilinearFunction< R, D >::getMin(), inet::math::UnireciprocalFunction< R, D >::getMin(), inet::math::UnilinearFunction< R, D >::getRange(), inet::math::BilinearFunction< R, D >::getRange(), inet::math::MinimumInterpolator< X, Y >::getValue(), inet::math::ApproximatedFunction< R, D, DIMENSION, X >::getValue(), inet::math::Interval< R >::intersectImpl(), and inet::Quaternion::toEulerAngles().
|
inline |
Returns the rest of a whole-numbered division.
Referenced by inet::_isNetworkNode(), inet::Ted::calculateShortestPaths(), inet::Ipv6FlatNetworkConfigurator::configureAdvPrefixes(), inet::Topology::extractFromNetwork(), inet::Ipv4FlatNetworkConfigurator::extractTopology(), inet::L3AddressResolver::findHostWithAddress(), inet::L3AddressResolver::findInterfaceWithMacAddress(), inet::findModuleFromPar(), inet::findModuleSomewhereUp(), inet::Topology::findNetworks(), inet::L3AddressResolver::getIpv4RoutingTableOf(), inet::L3AddressResolver::getIpv6RoutingTableOf(), inet::getModuleFromPar(), inet::Topology::getNodeFor(), inet::ScenarioManager::getRequiredModule(), inet::Ted::initializeTED(), inet::L3AddressResolver::interfaceTableOf(), inet::queueing::isApplication(), inet::isNetworkNode(), inet::ScenarioManager::processModuleSpecificCommand(), inet::ScenarioManager::processSetParamCommand(), inet::RsvpTe::readTrafficSessionFromXML(), inet::RsvpTe::sendPathNotify(), and inet::L3AddressResolver::tryResolve().
|
inline |
Returns the remainder r on division of dividend a by divisor n, using floored division.
The remainder r has the same sign as the divisor n.
Referenced by inet::EulerAngles::normalize().
|
inline |
|
inline |
Implementation of the n choose k (binomial coefficient) function, from the MiXiM Framework Author Karl Wessel.
Referenced by inet::physicallayer::DsssOqpsk16Modulation::calculateBER().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by inet::math::internal::print(), and inet::math::FunctionBase< R, Domain< X > >::print().
|
inline |
Convert a radian value to degree.
Referenced by inet::MobilityBase::updateDisplayStringFromMobilityState().
|
inline |
Returns an integer that corresponds to rounded double parameter.
Referenced by inet::visualizer::Ieee80211VisualizerBase::getIcon(), inet::power::SimpleEpEnergyStorage::handleMessage(), inet::VoipStreamSender::initialize(), inet::ospfv2::Ospfv2ConfigReader::loadInterfaceParameters(), inet::power::SimpleCcBattery::resolveDirective(), and inet::power::SimpleEpEnergyStorage::resolveDirective().
|
inline |
Returns 1 if the parameter is greater than zero, -1 if less than zero, 0 otherwise.
Referenced by inet::visualizer::LineManager::getLineShift(), inet::MobilityBase::reflectIfOutside(), inet::TractorMobility::setTargetPosition(), and inet::Coord::sign().
| void inet::math::simplifyAndCall | ( | const typename D::I & | i, |
| const BilinearFunction< R, D > * | f, | ||
| const std::function< void(const typename D::I &, const IFunction< R, D > *)> | callback | ||
| ) |
| void inet::math::simplifyAndCall | ( | const typename D::I & | i, |
| const IFunction< R, D > * | f, | ||
| const std::function< void(const typename D::I &, const IFunction< R, D > *)> | callback | ||
| ) |
Referenced by inet::math::AddedFunction< R, D >::partition(), inet::math::SubtractedFunction< R, D >::partition(), inet::math::MultipliedFunction< R, D >::partition(), inet::math::Combined2DFunction< R, X, Y >::partition(), inet::math::DividedFunction< R, D >::partition(), inet::math::SummedFunction< R, D >::partition(), and inet::math::Interpolated1DFunction< R, X >::partition().
| void inet::math::simplifyAndCall | ( | const typename D::I & | i, |
| const UnilinearFunction< R, D > * | f, | ||
| const std::function< void(const typename D::I &, const IFunction< R, D > *)> | callback | ||
| ) |
|
inline |
Referenced by inet::ieee80211::FrameSequenceHandler::abortFrameSequence(), inet::ieee80211::FrameSequenceContext::addStep(), inet::BonnMotionMobility::computeMaxSpeed(), inet::physicallayer::DimensionalAnalogModelBase::computeReceptionPower(), inet::ieee80211::RtsCtsFs::getHistory(), inet::ieee80211::FragFrameAckFs::getHistory(), inet::ieee80211::LastFrameAckFs::getHistory(), inet::ieee80211::BlockAckReqBlockAckFs::getHistory(), inet::ieee80211::OptionalFs::getStep(), inet::ieee80211::RepeatingFs::getStep(), inet::ieee80211::AlternativesFs::getStep(), inet::math::ApproximatedFunction< R, D, DIMENSION, X >::getValue(), inet::math::PeriodicallyInterpolated1DFunction< R, X >::getValue(), inet::SpatialGrid::LineSegmentIterator::operator++(), inet::math::PeriodicallyInterpolated1DFunction< R, X >::partition(), inet::Coord::step(), and inet::ieee80211::FrameSequenceContext::~FrameSequenceContext().
|
inline |
| Point<TS ...> inet::math::tail | ( | const Point< T, TS ... > & | p | ) |
Returns all but the first coordinate of p.
Referenced by iterateCorners(), and inet::eigrp::EigrpDeviceConfigurator::Str2Int().
|
inline |
|
inline |
Referenced by inet::math::internal::copyTupleElements(), inet::math::UnilinearFunction< R, D >::getA(), inet::math::UnilinearFunction< R, D >::getB(), inet::math::Point< T ... >::getImpl(), inet::math::LinearInterpolator< X, Y >::getValue(), inet::math::LineardbInterpolator< X, Y >::getValue(), inet::math::ApproximatedFunction< R, D, DIMENSION, X >::getValue(), inet::math::GaussFunction< R, X >::getValue(), inet::math::SawtoothFunction< R, X >::getValue(), inet::math::PeriodicallyInterpolated1DFunction< R, X >::getValue(), inet::math::Rasterized2DFunction< R, X, Y >::getValue(), inet::math::PeriodicallyInterpolated2DFunction< R, X, Y >::getValue(), inet::math::IntegratedFunction< R, Domain< X, Y >, DIMS, RI, Domain< X > >::getValue(), inet::math::IntegratedFunction< R, D, DIMS, RI, DI >::getValue(), inet::math::Interval< R >::getVolumeImpl(), inet::math::ConstantFunction< R, D >::isFinite(), inet::math::UnilinearFunction< R, D >::isFinite(), inet::math::BilinearFunction< R, D >::isFinite(), inet::math::Boxcar1DFunction< R, X >::isFinite(), inet::math::Boxcar2DFunction< R, X, Y >::isFinite(), inet::Int128::operator double(), inet::math::AddedFunction< R, D >::partition(), inet::math::MultipliedFunction< R, D >::partition(), inet::math::DividedFunction< R, D >::partition(), inet::math::PeriodicallyInterpolated1DFunction< R, X >::partition(), inet::math::Rasterized2DFunction< R, X, Y >::partition(), inet::math::PeriodicallyInterpolated2DFunction< R, X, Y >::partition(), inet::math::IntegratedFunction< R, Domain< X, Y >, DIMS, RI, Domain< X > >::partition(), and inet::math::Point< T ... >::setImpl().
|
inline |
| class INET_API inet::math::AddedFunction |
| class INET_API inet::math::ConstantFunction |
| class INET_API inet::math::DividedFunction |
| class INET_API inet::math::IntegratedFunction |
| class INET_API inet::math::MultipliedFunction |
| class INET_API inet::math::SubtractedFunction |