INET Framework for OMNeT++/OMNEST
|
Support functions for mathematical operations. 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... | |
int | sign (double i) |
Returns 1 if the parameter is greater or equal to zero, -1 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 | max (double a, double b) |
Returns the greater of the given parameters. More... | |
double | dB2fraction (double dB) |
Converts a dB value to fraction. More... | |
double | fraction2dB (double fraction) |
Convert a fraction value to dB. More... | |
double | dBm2mW (double dBm) |
Converts a dBm value into milliwatts. More... | |
double | mW2dBm (double mW) |
Convert a mW value to dBm. 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... | |
Support functions for mathematical operations.
This namespace contains all kind of mathematical support functions
|
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::AudioOutFile::AudioOutFile(), inet::cSocketRTScheduler::endRun(), inet::SCTPSocket::getAssocMaxRtx(), inet::PostureTransition::isMarkovian(), inet::TCPSocket::listenOnce(), inet::TCPAppBase::numInitStages(), inet::SCTPClient::numInitStages(), inet::tcp::TCP_NSC_Connection::SockPair::operator==(), PacketDrillScript::readScript(), inet::UDPSocket::setOutputGate(), and stepfunction().
|
inline |
Converts a dB value to fraction.
Referenced by inet::physicallayer::ParabolicAntenna::computeGain(), inet::physicallayer::MediumLimitCache::computeMaxAntennaGain(), inet::physicallayer::LogNormalShadowing::computePathLoss(), inet::physicallayer::SUIPathLoss::computePathLoss(), inet::physicallayer::UWBIRStochasticPathLoss::getGhassemzadehPathLoss(), inet::physicallayer::BreakpointPathLoss::initialize(), inet::physicallayer::ConstantGainAntenna::initialize(), inet::physicallayer::CosineAntenna::initialize(), inet::physicallayer::SNIRReceiverBase::initialize(), inet::physicallayer::ParabolicAntenna::initialize(), inet::physicallayer::RicianFading::initialize(), inet::physicallayer::FreeSpacePathLoss::initialize(), inet::physicallayer::APSKLayeredReceiver::initialize(), inet::physicallayer::DimensionalTransmitterBase::initialize(), inet::physicallayer::Ieee80211LayeredOFDMReceiver::initialize(), and inet::physicallayer::InterpolatingAntenna::parseMap().
|
inline |
Converts a dBm value into milliwatts.
Referenced by inet::physicallayer::MediumLimitCache::computeMinInterferencePower(), inet::physicallayer::MediumLimitCache::computeMinReceptionPower(), inet::physicallayer::IsotropicScalarBackgroundNoise::initialize(), inet::physicallayer::Ieee802154NarrowbandScalarReceiver::initialize(), inet::physicallayer::IsotropicDimensionalBackgroundNoise::initialize(), inet::physicallayer::FlatReceiverBase::initialize(), inet::physicallayer::APSKLayeredReceiver::initialize(), inet::WiseRoute::initialize(), and inet::physicallayer::Ieee80211LayeredOFDMReceiver::initialize().
|
inline |
Convert a degree value to radian.
Referenced by inet::physicallayer::CosineAntenna::computeGain(), inet::physicallayer::ParabolicAntenna::computeGain(), inet::visualizer::SceneCanvasVisualizer::computeViewAngle(), and inet::physicalenvironment::PhysicalEnvironment::parseObjects().
|
inline |
Returns the result of a whole-numbered division.
Referenced by inet::Int128::operator%=(), inet::Int128::operator/=(), and inet::Int128::toInt64().
|
inline |
|
inline |
Convert a fraction value to dB.
Referenced by inet::visualizer::TracingObstacleLossCanvasVisualizer::createObstacleLossVisualization(), inet::visualizer::MediumCanvasVisualizer::receptionStarted(), and inet::visualizer::MediumCanvasVisualizer::transmissionStarted().
|
inline |
Returns the greater of the given parameters.
Referenced by inet::physicallayer::MappingUtils::applyElementWiseOperator(), inet::VoIPStreamSender::checkSilence(), inet::BVHTree::computeBoundingBox(), inet::Prism::computeBoundingBoxSize(), inet::Polyhedron::computeBoundingBoxSize(), inet::physicallayer::ParabolicAntenna::computeGain(), inet::physicallayer::ConvolutionalCode::computeNetBitErrorRate(), inet::Polygon::computeSize(), inet::physicallayer::ConvolutionalCode::ConvolutionalCode(), inet::tcp::TCPBaseAlg::established(), inet::SimpleVoIPReceiver::evaluateTalkspurt(), inet::IntervalTree::fixupMaxHigh(), inet::LabeledIconFigure::getBounds(), inet::Box::getMax(), inet::GPSR::getPlanarNeighbors(), inet::AODVRouting::handleHelloMessage(), inet::UDPVideoStreamCli::handleNodeStart(), inet::UDPSink::handleNodeStart(), inet::UDPBasicApp::handleNodeStart(), inet::UDPBasicBurst::handleNodeStart(), inet::TelnetApp::handleOperationStage(), inet::TCPBasicClientApp::handleOperationStage(), inet::AODVRouting::handleRREP(), inet::AODVRouting::handleRREQ(), inet::physicallayer::Ieee80211OFDMInterleaver::Ieee80211OFDMInterleaver(), inet::visualizer::MediumCanvasVisualizer::initialize(), inet::physicallayer::SimpleConstMapping::initializeArguments(), inet::MobilityBase::isOutside(), inet::visualizer::isPointOnSegment(), inet::IntervalTree::leftRotate(), inet::SpatialGrid::LineSegmentIterator::LineSegmentIterator(), inet::tcp::memp_init(), inet::PIMDM::multicastPacketArrivedOnRpfInterface(), inet::physicalenvironment::PhysicalEnvironment::parseObjects(), inet::physicallayer::ConstMapping::print(), inet::tcp::TCPNewReno::recalculateSlowStartThreshold(), inet::tcp::TCPReno::recalculateSlowStartThreshold(), inet::tcp::TCPTahoe::recalculateSlowStartThreshold(), inet::tcp::TCPVegas::recalculateSlowStartThreshold(), inet::visualizer::MediumCanvasVisualizer::receptionStarted(), LinearGaugeFigure::redrawTicks(), ThermometerFigure::redrawTicks(), GaugeFigure::redrawTicks(), ProgressMeterFigure::refresh(), CounterFigure::refresh(), inet::SignalFigure::refresh(), inet::BarFigure::refreshDisplay(), inet::visualizer::MediumCanvasVisualizer::refreshSignalFigure(), inet::IntervalTree::rightRotate(), inet::IPv4NetworkConfigurator::routesCanBeNeighbors(), inet::TCPSessionApp::sendData(), inet::tcp::TCPBaseAlg::sendData(), inet::tcp::TCPSegmentTransmitInfoList::set(), inet::SCTPSocket::setHbInterval(), inet::httptools::rdExponential::setMaxLimit(), inet::Posture::setPostureSpeed(), inet::SCTPSocket::setRtoInfo(), inet::TCPSessionApp::socketEstablished(), inet::DHCPServer::startApp(), inet::DHCPClient::startApp(), and inet::AODVRouting::updateValidRouteLifeTime().
|
inline |
Returns the rest of a whole-numbered division.
Referenced by inet::TED::calculateShortestPaths(), inet::tcp::TCPConnection::cancelEvent(), inet::Topology::clear(), inet::FlatNetworkConfigurator6::configureAdvPrefixes(), inet::FlatNetworkConfigurator::extractTopology(), inet::L3AddressResolver::findHostWithAddress(), inet::findModuleFromPar(), inet::findModuleSomewhereUp(), inet::getModuleFromPar(), inet::Topology::getNumNodes(), inet::ScenarioManager::getRequiredGate(), inet::ScenarioManager::getRequiredModule(), inet::PPP::initialize(), inet::TED::initializeTED(), inet::L3AddressResolver::interfaceTableOf(), PacketDrill::PacketDrill(), inet::ScenarioManager::processModuleSpecificCommand(), inet::ScenarioManager::processSetParamCommand(), inet::RSVP::readTrafficSessionFromXML(), inet::NetAnimTrace::receiveSignal(), inet::L3AddressResolver::routingTable6Of(), inet::L3AddressResolver::routingTableOf(), inet::RSVP::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::MobilityBase::isOutside(), and inet::MobilityBase::reflectIfOutside().
|
inline |
Convert a mW value to dBm.
|
inline |
Implementation of the n choose k (binomial coefficient) function, from the MiXiM Framework Author Karl Wessel.
Referenced by inet::physicallayer::DSSSOQPSK16Modulation::calculateBER().
|
inline |
Convert a radian value to degree.
|
inline |
Returns an integer that corresponds to rounded double parameter.
Referenced by inet::power::SimpleEpEnergyStorage::handleMessage(), inet::VoIPStreamSender::initialize(), and inet::visualizer::MediumCanvasVisualizer::receptionStarted().
|
inline |
Returns 1 if the parameter is greater or equal to zero, -1 otherwise.
Referenced by inet::visualizer::LineManager::getLineShift(), inet::MobilityBase::isOutside(), inet::MobilityBase::reflectIfOutside(), and inet::TractorMobility::setTargetPosition().
|
inline |
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.