#include <cmath>#include <limits>#include <vector>#include "base/kaldi-types.h"#include "base/kaldi-common.h"

Go to the source code of this file.
Classes | |
| struct | RandomState |
Namespaces | |
| kaldi | |
| This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for mispronunciations detection tasks, the reference: | |
Macros | |
| #define | DBL_EPSILON 2.2204460492503131e-16 |
| #define | FLT_EPSILON 1.19209290e-7f |
| #define | M_PI 3.1415926535897932384626433832795 |
| #define | M_SQRT2 1.4142135623730950488016887 |
| #define | M_2PI 6.283185307179586476925286766559005 |
| #define | M_SQRT1_2 0.7071067811865475244008443621048490 |
| #define | M_LOG_2PI 1.8378770664093454835606594728112 |
| #define | M_LN2 0.693147180559945309417232121458 |
| #define | M_LN10 2.302585092994045684017991454684 |
| #define | KALDI_ISNAN std::isnan |
| #define | KALDI_ISINF std::isinf |
| #define | KALDI_ISFINITE(x) std::isfinite(x) |
| #define | KALDI_SQR(x) ((x) * (x)) |
Functions | |
| double | Exp (double x) |
| float | Exp (float x) |
| double | Log (double x) |
| float | Log (float x) |
| double | Log1p (double x) |
| float | Log1p (float x) |
| int | Rand (struct RandomState *state) |
| int32 | RandInt (int32 min_val, int32 max_val, struct RandomState *state) |
| bool | WithProb (BaseFloat prob, struct RandomState *state) |
| float | RandUniform (struct RandomState *state=NULL) |
| Returns a random number strictly between 0 and 1. More... | |
| float | RandGauss (struct RandomState *state=NULL) |
| int32 | RandPoisson (float lambda, struct RandomState *state) |
| void | RandGauss2 (float *a, float *b, RandomState *state) |
| void | RandGauss2 (double *a, double *b, RandomState *state) |
| template<class Float > | |
| Float | RandPrune (Float post, BaseFloat prune_thresh, struct RandomState *state=NULL) |
| double | LogAdd (double x, double y) |
| float | LogAdd (float x, float y) |
| double | LogSub (double x, double y) |
| float | LogSub (float x, float y) |
| static bool | ApproxEqual (float a, float b, float relative_tolerance=0.001) |
| return abs(a - b) <= relative_tolerance * (abs(a)+abs(b)). More... | |
| static void | AssertEqual (float a, float b, float relative_tolerance=0.001) |
| assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b)) More... | |
| int32 | RoundUpToNearestPowerOfTwo (int32 n) |
| static int32 | DivideRoundingDown (int32 a, int32 b) |
| Returns a / b, rounding towards negative infinity in all cases. More... | |
| template<class I > | |
| I | Gcd (I m, I n) |
| template<class I > | |
| I | Lcm (I m, I n) |
| Returns the least common multiple of two integers. More... | |
| template<class I > | |
| void | Factorize (I m, std::vector< I > *factors) |
| double | Hypot (double x, double y) |
| float | Hypot (float x, float y) |
Variables | |
| static const double | kMinLogDiffDouble = Log(DBL_EPSILON) |
| static const float | kMinLogDiffFloat = Log(FLT_EPSILON) |
| const float | kLogZeroFloat = -std::numeric_limits<float>::infinity() |
| const double | kLogZeroDouble = -std::numeric_limits<double>::infinity() |
| const BaseFloat | kLogZeroBaseFloat = -std::numeric_limits<BaseFloat>::infinity() |
| #define DBL_EPSILON 2.2204460492503131e-16 |
Definition at line 37 of file kaldi-math.h.
Referenced by kaldi::UnitTestDefines().
| #define FLT_EPSILON 1.19209290e-7f |
Definition at line 40 of file kaldi-math.h.
Referenced by kaldi::UnitTestDefines().
| #define KALDI_ISFINITE | ( | x | ) | std::isfinite(x) |
Definition at line 74 of file kaldi-math.h.
Referenced by MultiTaskLoss::AvgLoss(), AmSgmm2::ComputeNormalizersInternal(), Xent::Eval(), Mse::Eval(), kaldi::HouseBackward(), main(), PdfPrior::PdfPrior(), kaldi::QrStep(), and kaldi::UnitTestDefines().
| #define KALDI_ISINF std::isinf |
Definition at line 73 of file kaldi-math.h.
Referenced by Nnet::Check(), kaldi::nnet1::CheckNanInf(), FullGmm::ComponentPosteriors(), DiagGmm::ComponentPosteriors(), kaldi::ComputeGconsts(), FullGmm::ComputeGconsts(), DiagGmm::ComputeGconsts(), OptimizeLbfgs< Real >::ComputeHifNeeded(), DiscriminativeComputation::ConvertAnswersToLogLike(), kaldi::HouseBackward(), NnetDiscriminativeUpdater::LatticeComputations(), FullGmm::LogLikelihood(), DiagGmm::LogLikelihood(), DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased(), PushSpecialClass::ModifyFst(), and kaldi::UnitTestDefines().
| #define KALDI_ISNAN std::isnan |
Definition at line 72 of file kaldi-math.h.
Referenced by Nnet::Check(), kaldi::nnet1::CheckNanInf(), FullGmm::ComponentPosteriors(), DiagGmm::ComponentPosteriors(), MelBanks::Compute(), FullGmm::ComputeGconsts(), kaldi::ComputeGconsts(), DiagGmm::ComputeGconsts(), OptimizeLbfgs< Real >::ComputeHifNeeded(), RegtreeFmllrDiagGmm::ComputeLogDets(), DiscriminativeComputation::ConvertAnswersToLogLike(), kaldi::HouseBackward(), NnetDiscriminativeUpdater::LatticeComputations(), kaldi::LatticeForwardBackwardMpeVariants(), FullGmm::LogLikelihood(), DiagGmm::LogLikelihood(), DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased(), kaldi::LogSub(), PushSpecialClass::ModifyFst(), GaussClusterable::Objf(), OnlineIvectorEstimationStats::ObjfChange(), kaldi::SumClusterableNormalizer(), kaldi::SumClusterableObjf(), and kaldi::UnitTestDefines().
| #define KALDI_SQR | ( | x | ) | ((x) * (x)) |
Definition at line 77 of file kaldi-math.h.
| #define M_2PI 6.283185307179586476925286766559005 |
Definition at line 52 of file kaldi-math.h.
Referenced by kaldi::ComplexFftRecursive(), kaldi::ComplexFt(), SplitRadixRealFft< float >::Compute(), SplitRadixComplexFft< float >::ComputeTables(), kaldi::ExtendWaveWithSilence(), FeatureWindowFunction::FeatureWindowFunction(), ArbitraryResample::FilterFunc(), LinearResample::FilterFunc(), TestFunction::operator()(), kaldi::RealFft(), kaldi::UnitTestDefines(), kaldi::UnitTestDelay(), kaldi::UnitTestPieces(), and kaldi::UnitTestSearch().
| #define M_LN10 2.302585092994045684017991454684 |
Definition at line 68 of file kaldi-math.h.
Referenced by ArpaFileParser::Read().
| #define M_LN2 0.693147180559945309417232121458 |
Definition at line 64 of file kaldi-math.h.
| #define M_LOG_2PI 1.8378770664093454835606594728112 |
Definition at line 60 of file kaldi-math.h.
Referenced by FmllrRawAccs::AccumulateForGmm(), IvectorExtractor::ComputeDerivedVars(), FullGmm::ComputeGconsts(), kaldi::ComputeGconsts(), DiagGmm::ComputeGconsts(), PldaEstimator::ComputeObjfPart1(), PldaEstimator::ComputeObjfPart2(), GetLogLikeTest(), IvectorExtractor::GetPriorAuxf(), Plda::LogLikelihoodRatio(), GaussClusterable::Objf(), kaldi::UnitTestDefines(), kaldi::UnitTestDiagGmm(), UnitTestEstimateFullGmm(), and UnitTestFullGmm().
| #define M_PI 3.1415926535897932384626433832795 |
Definition at line 44 of file kaldi-math.h.
Referenced by kaldi::ComputeDctMatrix(), kaldi::ComputeLifterCoeffs(), MleAmSgmm2Updater::ComputeMPrior(), AmSgmm2::ComputeNormalizersInternal(), ArbitraryResample::FilterFunc(), LinearResample::FilterFunc(), kaldi::InitIdftBases(), kaldi::nnet3::PerturbImage(), kaldi::RandGauss(), kaldi::RandGauss2(), and kaldi::UnitTestDefines().
| #define M_SQRT1_2 0.7071067811865475244008443621048490 |
Definition at line 56 of file kaldi-math.h.
Referenced by SplitRadixComplexFft< float >::ComputeRecursive().
| #define M_SQRT2 1.4142135623730950488016887 |
Definition at line 48 of file kaldi-math.h.
Referenced by MfccComputer::Compute(), and IvectorExtractorStats::UpdatePrior().