Provides a vector abstraction class. More...
#include <kaldi-vector.h>
Public Member Functions | |
void | SetZero () |
Set vector to all zeros. More... | |
bool | IsZero (Real cutoff=1.0e-06) const |
Returns true if matrix is all zeros. More... | |
void | Set (Real f) |
Set all members of a vector to a specified value. More... | |
void | SetRandn () |
Set vector to random normally-distributed noise. More... | |
void | SetRandUniform () |
Sets to numbers uniformly distributed on (0,1) More... | |
MatrixIndexT | RandCategorical () const |
This function returns a random index into this vector, chosen with probability proportional to the corresponding element. More... | |
MatrixIndexT | Dim () const |
Returns the dimension of the vector. More... | |
MatrixIndexT | SizeInBytes () const |
Returns the size in memory of the vector, in bytes. More... | |
Real * | Data () |
Returns a pointer to the start of the vector's data. More... | |
const Real * | Data () const |
Returns a pointer to the start of the vector's data (const). More... | |
Real | operator() (MatrixIndexT i) const |
Indexing operator (const). More... | |
Real & | operator() (MatrixIndexT i) |
Indexing operator (non-const). More... | |
SubVector< Real > | Range (const MatrixIndexT o, const MatrixIndexT l) |
Returns a sub-vector of a vector (a range of elements). More... | |
const SubVector< Real > | Range (const MatrixIndexT o, const MatrixIndexT l) const |
Returns a const sub-vector of a vector (a range of elements). More... | |
void | CopyFromVec (const VectorBase< Real > &v) |
Copy data from another vector (must match own size). More... | |
template<typename OtherReal > | |
void | CopyFromPacked (const PackedMatrix< OtherReal > &M) |
Copy data from a SpMatrix or TpMatrix (must match own size). More... | |
template<typename OtherReal > | |
void | CopyFromVec (const VectorBase< OtherReal > &v) |
Copy data from another vector of different type (double vs. float) More... | |
template<typename OtherReal > | |
void | CopyFromVec (const CuVectorBase< OtherReal > &v) |
Copy from CuVector. This is defined in ../cudamatrix/cu-vector.h. More... | |
void | Floor (const VectorBase< Real > &v, Real floor_val, MatrixIndexT *floored_count=nullptr) |
Applies floor to all elements. More... | |
void | Ceiling (const VectorBase< Real > &v, Real ceil_val, MatrixIndexT *ceiled_count=nullptr) |
Applies ceiling to all elements. More... | |
void | Pow (const VectorBase< Real > &v, Real power) |
void | ApplyLog () |
Apply natural log to all elements. More... | |
void | ApplyLogAndCopy (const VectorBase< Real > &v) |
Apply natural log to another vector and put result in *this. More... | |
void | ApplyExp () |
Apply exponential to each value in vector. More... | |
void | ApplyAbs () |
Take absolute value of each of the elements. More... | |
void | ApplyFloor (Real floor_val, MatrixIndexT *floored_count=nullptr) |
Applies floor to all elements. More... | |
void | ApplyCeiling (Real ceil_val, MatrixIndexT *ceiled_count=nullptr) |
Applies ceiling to all elements. More... | |
MatrixIndexT | ApplyFloor (const VectorBase< Real > &floor_vec) |
Applies floor to all elements. Returns number of elements floored. More... | |
Real | ApplySoftMax () |
Apply soft-max to vector and return normalizer (log sum of exponentials). More... | |
Real | ApplyLogSoftMax () |
Applies log soft-max to vector and returns normalizer (log sum of exponentials). More... | |
void | Tanh (const VectorBase< Real > &src) |
Sets each element of *this to the tanh of the corresponding element of "src". More... | |
void | Sigmoid (const VectorBase< Real > &src) |
Sets each element of *this to the sigmoid function of the corresponding element of "src". More... | |
void | ApplyPow (Real power) |
Take all elements of vector to a power. More... | |
void | ApplyPowAbs (Real power, bool include_sign=false) |
Take the absolute value of all elements of a vector to a power. More... | |
Real | Norm (Real p) const |
Compute the p-th norm of the vector. More... | |
bool | ApproxEqual (const VectorBase< Real > &other, float tol=0.01) const |
Returns true if ((*this)-other).Norm(2.0) <= tol * (*this).Norm(2.0). More... | |
void | InvertElements () |
Invert all elements. More... | |
template<typename OtherReal > | |
void | AddVec (const Real alpha, const VectorBase< OtherReal > &v) |
Add vector : *this = *this + alpha * rv (with casting between floats and doubles) More... | |
void | AddVec2 (const Real alpha, const VectorBase< Real > &v) |
Add vector : *this = *this + alpha * rv^2 [element-wise squaring]. More... | |
template<typename OtherReal > | |
void | AddVec2 (const Real alpha, const VectorBase< OtherReal > &v) |
Add vector : *this = *this + alpha * rv^2 [element-wise squaring], with casting between floats and doubles. More... | |
void | AddMatVec (const Real alpha, const MatrixBase< Real > &M, const MatrixTransposeType trans, const VectorBase< Real > &v, const Real beta) |
Add matrix times vector : this <– beta*this + alpha*M*v. More... | |
void | AddMatSvec (const Real alpha, const MatrixBase< Real > &M, const MatrixTransposeType trans, const VectorBase< Real > &v, const Real beta) |
This is as AddMatVec, except optimized for where v contains a lot of zeros. More... | |
void | AddSpVec (const Real alpha, const SpMatrix< Real > &M, const VectorBase< Real > &v, const Real beta) |
Add symmetric positive definite matrix times vector: this <– beta*this + alpha*M*v. More... | |
void | AddTpVec (const Real alpha, const TpMatrix< Real > &M, const MatrixTransposeType trans, const VectorBase< Real > &v, const Real beta) |
Add triangular matrix times vector: this <– beta*this + alpha*M*v. More... | |
void | ReplaceValue (Real orig, Real changed) |
Set each element to y = (x == orig ? changed : x). More... | |
void | MulElements (const VectorBase< Real > &v) |
Multiply element-by-element by another vector. More... | |
template<typename OtherReal > | |
void | MulElements (const VectorBase< OtherReal > &v) |
Multiply element-by-element by another vector of different type. More... | |
void | DivElements (const VectorBase< Real > &v) |
Divide element-by-element by a vector. More... | |
template<typename OtherReal > | |
void | DivElements (const VectorBase< OtherReal > &v) |
Divide element-by-element by a vector of different type. More... | |
void | Add (Real c) |
Add a constant to each element of a vector. More... | |
void | AddVecVec (Real alpha, const VectorBase< Real > &v, const VectorBase< Real > &r, Real beta) |
Add element-by-element product of vectors: More... | |
void | AddVecDivVec (Real alpha, const VectorBase< Real > &v, const VectorBase< Real > &r, Real beta) |
Add element-by-element quotient of two vectors. More... | |
void | Scale (Real alpha) |
Multiplies all elements by this constant. More... | |
void | MulTp (const TpMatrix< Real > &M, const MatrixTransposeType trans) |
Multiplies this vector by lower-triangular matrix: *this <– *this *M. More... | |
void | Solve (const TpMatrix< Real > &M, const MatrixTransposeType trans) |
If trans == kNoTrans, solves M x = b, where b is the value of *this at input and x is the value of *this at output. More... | |
void | CopyRowsFromMat (const MatrixBase< Real > &M) |
Performs a row stack of the matrix M. More... | |
template<typename OtherReal > | |
void | CopyRowsFromMat (const MatrixBase< OtherReal > &M) |
void | CopyRowsFromMat (const CuMatrixBase< Real > &M) |
The following is implemented in ../cudamatrix/cu-matrix.cc. More... | |
void | CopyColsFromMat (const MatrixBase< Real > &M) |
Performs a column stack of the matrix M. More... | |
void | CopyRowFromMat (const MatrixBase< Real > &M, MatrixIndexT row) |
Extracts a row of the matrix M. More... | |
template<typename OtherReal > | |
void | CopyRowFromMat (const MatrixBase< OtherReal > &M, MatrixIndexT row) |
Extracts a row of the matrix M with type conversion. More... | |
template<typename OtherReal > | |
void | CopyRowFromSp (const SpMatrix< OtherReal > &S, MatrixIndexT row) |
Extracts a row of the symmetric matrix S. More... | |
template<typename OtherReal > | |
void | CopyColFromMat (const MatrixBase< OtherReal > &M, MatrixIndexT col) |
Extracts a column of the matrix M. More... | |
void | CopyDiagFromMat (const MatrixBase< Real > &M) |
Extracts the diagonal of the matrix M. More... | |
void | CopyDiagFromPacked (const PackedMatrix< Real > &M) |
Extracts the diagonal of a packed matrix M; works for Sp or Tp. More... | |
void | CopyDiagFromSp (const SpMatrix< Real > &M) |
Extracts the diagonal of a symmetric matrix. More... | |
void | CopyDiagFromTp (const TpMatrix< Real > &M) |
Extracts the diagonal of a triangular matrix. More... | |
Real | Max () const |
Returns the maximum value of any element, or -infinity for the empty vector. More... | |
Real | Max (MatrixIndexT *index) const |
Returns the maximum value of any element, and the associated index. More... | |
Real | Min () const |
Returns the minimum value of any element, or +infinity for the empty vector. More... | |
Real | Min (MatrixIndexT *index) const |
Returns the minimum value of any element, and the associated index. More... | |
Real | Sum () const |
Returns sum of the elements. More... | |
Real | SumLog () const |
Returns sum of the logs of the elements. More... | |
void | AddRowSumMat (Real alpha, const MatrixBase< Real > &M, Real beta=1.0) |
Does *this = alpha * (sum of rows of M) + beta * *this. More... | |
void | AddColSumMat (Real alpha, const MatrixBase< Real > &M, Real beta=1.0) |
Does *this = alpha * (sum of columns of M) + beta * *this. More... | |
void | AddDiagMat2 (Real alpha, const MatrixBase< Real > &M, MatrixTransposeType trans=kNoTrans, Real beta=1.0) |
Add the diagonal of a matrix times itself: *this = diag(M M^T) + beta * *this (if trans == kNoTrans), or *this = diag(M^T M) + beta * *this (if trans == kTrans). More... | |
void | AddDiagMatMat (Real alpha, const MatrixBase< Real > &M, MatrixTransposeType transM, const MatrixBase< Real > &N, MatrixTransposeType transN, Real beta=1.0) |
Add the diagonal of a matrix product: *this = diag(M N), assuming the "trans" arguments are both kNoTrans; for transpose arguments, it behaves as you would expect. More... | |
Real | LogSumExp (Real prune=-1.0) const |
Returns log(sum(exp())) without exp overflow If prune > 0.0, ignores terms less than the max - prune. More... | |
void | Read (std::istream &in, bool binary, bool add=false) |
Reads from C++ stream (option to add to existing contents). More... | |
void | Write (std::ostream &Out, bool binary) const |
Writes to C++ stream (option to write in binary). More... | |
template<> | |
void | AddVec (const float alpha, const VectorBase< float > &rv) |
template<> | |
void | AddVec (const double alpha, const VectorBase< double > &rv) |
template<> | |
void | AddVec (const float alpha, const VectorBase< float > &v) |
template<> | |
void | AddVec (const double alpha, const VectorBase< double > &v) |
Protected Member Functions | |
~VectorBase () | |
Destructor; does not deallocate memory, this is handled by child classes. More... | |
VectorBase () | |
Empty initializer, corresponds to vector of zero size. More... | |
void | CopyFromPtr (const Real *Data, MatrixIndexT sz) |
Load data into the vector: sz must match own size. More... | |
KALDI_DISALLOW_COPY_AND_ASSIGN (VectorBase) | |
Protected Attributes | |
Real * | data_ |
data memory area More... | |
MatrixIndexT | dim_ |
dimension of vector More... | |
Friends | |
class | VectorBase< double > |
class | VectorBase< float > |
class | CuVectorBase< Real > |
class | CuVector< Real > |
Provides a vector abstraction class.
This class provides a way to work with vectors in kaldi. It encapsulates basic operations and memory optimizations.
Definition at line 41 of file kaldi-vector.h.
|
inlineprotected |
Destructor; does not deallocate memory, this is handled by child classes.
This destructor is protected so this object can only be deleted via a child.
Definition at line 376 of file kaldi-vector.h.
|
inlineexplicitprotected |
Empty initializer, corresponds to vector of zero size.
Definition at line 379 of file kaldi-vector.h.
void Add | ( | Real | c | ) |
Add a constant to each element of a vector.
Definition at line 956 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), AmSgmm2::ComponentLogLikes(), kaldi::ComputeCorrelation(), OnlinePreconditioner::ComputeZt(), OnlineNaturalGradient::ComputeZt(), IvectorExtractor::GetAcousticAuxfWeight(), LogisticRegression::GetLogPosteriors(), Plda::GetNormalizationFactor(), ConstantComponent::InitFromConfig(), ConstantFunctionComponent::InitFromConfig(), Plda::LogLikelihoodRatio(), main(), kaldi::nnet1::MomentStatistics(), OnlinePitchFeatureImpl::OnlinePitchFeatureImpl(), PdfPrior::PdfPrior(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlinePreconditioner::PreconditionDirectionsInternal(), OnlineNaturalGradient::PreconditionDirectionsInternal(), kaldi::ProcessWindow(), AccumDiagGmm::SmoothStats(), AccumDiagGmm::SmoothWithModel(), MleAmSgmm2Updater::UpdatePhoneVectorsInternal(), MleAmSgmm2Updater::UpdateSubstateWeights(), MleAmSgmm2Updater::UpdateW(), MleAmSgmm2Updater::UpdateWGetStats(), and MleSgmm2SpeakerAccs::UpdateWithU().
void AddColSumMat | ( | Real | alpha, |
const MatrixBase< Real > & | M, | ||
Real | beta = 1.0 |
||
) |
Does *this = alpha * (sum of columns of M) + beta * *this.
Definition at line 734 of file kaldi-vector.cc.
Referenced by VectorBase< float >::CopyDiagFromTp(), kaldi::CuVectorUnitTestAddColSumMat(), KlHmm::PropagateFnc(), kaldi::UnitTestAddColSumMatSpeed(), kaldi::UnitTestCuDiffLogSoftmax(), kaldi::UnitTestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMatLarge(), and kaldi::UnitTestSimpleForVec().
void AddDiagMat2 | ( | Real | alpha, |
const MatrixBase< Real > & | M, | ||
MatrixTransposeType | trans = kNoTrans , |
||
Real | beta = 1.0 |
||
) |
Add the diagonal of a matrix times itself: *this = diag(M M^T) + beta * *this (if trans == kNoTrans), or *this = diag(M^T M) + beta * *this (if trans == kTrans).
Definition at line 1304 of file kaldi-vector.cc.
Referenced by VectorBase< float >::CopyDiagFromTp(), kaldi::CuVectorUnitTestAddDiagMat2(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), kaldi::SlidingWindowCmnInternal(), kaldi::UnitTestAddDiagMat2(), and kaldi::UnitTestCuDiffNormalizePerRow().
void AddDiagMatMat | ( | Real | alpha, |
const MatrixBase< Real > & | M, | ||
MatrixTransposeType | transM, | ||
const MatrixBase< Real > & | N, | ||
MatrixTransposeType | transN, | ||
Real | beta = 1.0 |
||
) |
Add the diagonal of a matrix product: *this = diag(M N), assuming the "trans" arguments are both kNoTrans; for transpose arguments, it behaves as you would expect.
Definition at line 1328 of file kaldi-vector.cc.
Referenced by VectorBase< float >::CopyDiagFromTp(), kaldi::UnitTestAddDiagMatMat(), kaldi::UnitTestCuDiffNormalizePerRow(), and kaldi::UnitTestCuDiffSoftmax().
void AddMatSvec | ( | const Real | alpha, |
const MatrixBase< Real > & | M, | ||
const MatrixTransposeType | trans, | ||
const VectorBase< Real > & | v, | ||
const Real | beta | ||
) |
This is as AddMatVec, except optimized for where v contains a lot of zeros.
Definition at line 105 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), and kaldi::UnitTestVecmul().
void AddMatVec | ( | const Real | alpha, |
const MatrixBase< Real > & | M, | ||
const MatrixTransposeType | trans, | ||
const VectorBase< Real > & | v, | ||
const Real | beta | ||
) |
Add matrix times vector : this <– beta*this + alpha*M*v.
Calls BLAS GEMV.
Definition at line 92 of file kaldi-vector.cc.
Referenced by OnlineIvectorEstimationStats::AccStats(), MleSgmm2SpeakerAccs::AccumulateFromPosteriors(), LdaEstimate::AddMeanOffset(), kaldi::ApplyAffineTransform(), ApplyFmllrXform(), VectorBase< float >::ApplyPow(), Fmpe::ApplyProjection(), Plda::ApplyTransform(), IvectorExtractorStats::CommitStatsForWPoint(), AmSgmm2::ComponentLogLikes(), MfccComputer::Compute(), kaldi::ComputeAmGmmFeatureDeriv(), Plda::ComputeDerivedVars(), AmSgmm2::ComputeFmllrPreXform(), MleAmSgmm2Updater::ComputeSMeans(), FmllrRawAccs::ConvertToSimpleStats(), kaldi::CuVectorUnitTestAddMatVec(), BasisFmllrEstimate::EstimateFmllrBasis(), FeatureTransformEstimateMulti::EstimateTransformPart(), kaldi::generate_features(), IvectorExtractor::GetAcousticAuxfMean(), IvectorExtractor::GetAcousticAuxfWeight(), kaldi::GetFeatDeriv(), OnlineTransform::GetFrame(), IvectorExtractor::GetIvectorDistMean(), IvectorExtractor::GetIvectorDistWeight(), LogisticRegression::GetLogPosteriors(), IvectorExtractorStats::GetOrthogonalIvectorTransform(), RegtreeMllrDiagGmm::GetTransformedMeans(), FullGmm::LogLikelihoods(), DiagGmm::LogLikelihoods(), DiagGmm::LogLikelihoodsPreselect(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased(), main(), MleAmSgmm2Updater::RenormalizeV(), kaldi::SolveDoubleQuadraticMatrixProblem(), kaldi::SolveQuadraticProblem(), Plda::TransformIvector(), UnitTestEstimateLda(), kaldi::UnitTestMul(), kaldi::UnitTestPldaEstimation(), FmllrRawAccs::Update(), EbwAmSgmm2Updater::UpdatePhoneVectorsInternal(), MleAmSgmm2Updater::UpdatePhoneVectorsInternal(), MleSgmm2SpeakerAccs::UpdateWithU(), and kaldi::VecMatVec().
void AddRowSumMat | ( | Real | alpha, |
const MatrixBase< Real > & | M, | ||
Real | beta = 1.0 |
||
) |
Does *this = alpha * (sum of rows of M) + beta * *this.
Definition at line 714 of file kaldi-vector.cc.
Referenced by CovarianceStats::AccStats(), PldaStats::AddSamples(), IvectorExtractorStats::CommitStatsForW(), VectorBase< float >::CopyDiagFromTp(), kaldi::CuVectorUnitTestAddRowSumMat(), kaldi::EstPca(), LdaEstimate::GetStats(), main(), AmSgmm2::SplitSubstatesInGroup(), kaldi::TestOnlineCmnInput(), kaldi::UnitTestAddRowSumMatSpeed(), kaldi::UnitTestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMatLarge(), UnitTestEstimateFullGmm(), EbwAmSgmm2Updater::Update(), MleAmSgmm2Updater::Update(), and kaldi::nnet2::UpdateHash().
void AddSpVec | ( | const Real | alpha, |
const SpMatrix< Real > & | M, | ||
const VectorBase< Real > & | v, | ||
const Real | beta | ||
) |
Add symmetric positive definite matrix times vector: this <– beta*this + alpha*M*v.
Calls BLAS SPMV.
Definition at line 141 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), kaldi::CalBasisFmllrStepSize(), AmSgmm2::ComputePerFrameVars(), FullGmmNormal::CopyToFullGmm(), kaldi::CuVectorUnitTestAddSpVec(), kaldi::FmllrAuxfGradient(), kaldi::FmllrAuxFuncDiagGmm(), kaldi::FmllrInnerUpdate(), IvectorExtractor::GetAcousticAuxfMean(), FullGmm::GetComponentMean(), IvectorExtractor::GetIvectorDistribution(), PldaEstimator::GetStatsFromClassMeans(), main(), kaldi::MllrAuxFunction(), FullGmm::SetInvCovars(), FullGmm::SetInvCovarsAndMeans(), kaldi::SolveQuadraticProblem(), AmSgmm2::SplitSubstatesInGroup(), SpMatrix< float >::TopEigs(), kaldi::UnitTestLbfgs(), kaldi::UnitTestLinearCgd(), kaldi::UnitTestMul(), kaldi::UnitTestSolve(), MlltAccs::Update(), EbwAmSgmm2Updater::UpdatePhoneVectorsInternal(), and MleSgmm2SpeakerAccs::UpdateWithU().
void AddTpVec | ( | const Real | alpha, |
const TpMatrix< Real > & | M, | ||
const MatrixTransposeType | trans, | ||
const VectorBase< Real > & | v, | ||
const Real | beta | ||
) |
Add triangular matrix times vector: this <– beta*this + alpha*M*v.
Works even if rv == *this.
Definition at line 1263 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), FastNnetCombiner::ComputeCurrentNnet(), FastNnetCombiner::ComputeObjfAndGradient(), FullGmmNormal::Rand(), kaldi::UnitTestCuVectorAddTp(), kaldi::UnitTestCuVectorAddTpVec(), kaldi::UnitTestMul(), and kaldi::UnitTestTriVecSolver().
void AddVec | ( | const float | alpha, |
const VectorBase< float > & | rv | ||
) |
void AddVec< double > | ( | const double | alpha, |
const VectorBase< double > & | rv | ||
) |
void AddVec | ( | const float | alpha, |
const VectorBase< float > & | v | ||
) |
Definition at line 75 of file kaldi-vector.cc.
void AddVec | ( | const double | alpha, |
const VectorBase< double > & | v | ||
) |
Definition at line 84 of file kaldi-vector.cc.
void AddVec | ( | const Real | alpha, |
const VectorBase< OtherReal > & | v | ||
) |
Add vector : *this = *this + alpha * rv (with casting between floats and doubles)
Definition at line 1044 of file kaldi-vector.cc.
Referenced by OptimizeLbfgs< Real >::AcceptStep(), OnlineIvectorEstimationStats::AccStats(), AccumFullGmm::AccumulateFromPosteriors(), FmllrRawAccs::AccumulateFromPosteriors(), AccumDiagGmm::AccumulateFromPosteriors(), MleAmSgmm2Accs::AccumulateFromPosteriors(), MleSgmm2SpeakerAccs::AccumulateFromPosteriors(), RestrictedAttentionComponent::Add(), AccumDiagGmm::Add(), IvectorExtractorStats::Add(), kaldi::ApplyCmvn(), VectorBase< float >::ApplyPow(), Fmpe::ApplyProjection(), VectorBase< float >::ApproxEqual(), IvectorExtractorStats::CommitStatsForM(), IvectorExtractorStats::CommitStatsForPrior(), AmSgmm2::ComponentLogLikes(), kaldi::ComputeAmGmmFeatureDeriv(), kaldi::ComputeAndSubtractMean(), PitchFrameInfo::ComputeBacktraces(), Fmpe::ComputeC(), kaldi::ComputeFeatureNormalizingTransform(), AmSgmm2::ComputeFmllrPreXform(), AmSgmm2::ComputeGammaI(), Sgmm2Project::ComputeLdaStats(), kaldi::ComputeLocalCost(), OptimizeLbfgs< Real >::ComputeNewDirection(), PldaEstimator::ComputeObjfPart2(), EbwAmSgmm2Updater::ComputePhoneVecStats(), BasisFmllrEstimate::ComputeTransform(), CompressedAffineXformStats::CopyFromAffineXformStats(), kaldi::DiagGmmToStats(), kaldi::EBWUpdateGaussian(), kaldi::FmllrInnerUpdate(), kaldi::GenRandStats(), kaldi::GetFeatureMeanAndVariance(), IvectorExtractor::GetIvectorDistribution(), GetLogLikeTest(), PldaEstimator::GetStatsFromClassMeans(), AmSgmm2::GetSubstateSpeakerMean(), kaldi::LinearCgd(), Plda::LogLikelihoodRatio(), main(), FullGmm::Merge(), DiagGmm::merged_components_logdet(), FullGmm::MergedComponentsLogdet(), SoftmaxComponent::MixUp(), kaldi::operator>>(), OnlineCmnInput::OutputFrame(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), kaldi::nnet2::PrintPriorDiagnostics(), kaldi::nnet3::PrintPriorDiagnostics(), DeltaFeatures::Process(), ShiftedDeltaFeatures::Process(), AccumFullGmm::Read(), LdaEstimate::Read(), OptimizeLbfgs< Real >::Restart(), kaldi::SlidingWindowCmnInternal(), Plda::SmoothWithinClassCovariance(), kaldi::SolveQuadraticProblem(), RestrictedAttentionComponent::StoreStats(), kaldi::TestClusterKMeansVector(), kaldi::TestOnlineCmnInput(), SpMatrix< float >::TopEigs(), kaldi::TypeOneUsage(), kaldi::TypeThreeUsage(), kaldi::UnitTestAddDiagMat2(), kaldi::UnitTestAddDiagMatMat(), kaldi::UnitTestAddDiagVecMat(), kaldi::UnitTestAddVecCross(), kaldi::UnitTestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMatLarge(), kaldi::UnitTestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMatLarge(), kaldi::UnitTestCuVectorAddVec(), UnitTestEstimateDiagGmm(), UnitTestEstimateLda(), kaldi::UnitTestEstimateMmieDiagGmm(), kaldi::UnitTestLbfgs(), kaldi::UnitTestLinearCgd(), kaldi::UnitTestSparseVectorAddToVec(), kaldi::UpdateEbwDiagGmm(), EbwAmSgmm2Updater::UpdatePhoneVectorsInternal(), MleAmSgmm2Updater::UpdatePhoneVectorsInternal(), PldaUnsupervisedAdaptor::UpdatePlda(), EbwAmSgmm2Updater::UpdateU(), MleAmSgmm2Updater::UpdateU(), EbwAmSgmm2Updater::UpdateW(), and MleSgmm2SpeakerAccs::UpdateWithU().
void AddVec2 | ( | const Real | alpha, |
const VectorBase< Real > & | v | ||
) |
Add vector : *this = *this + alpha * rv^2 [element-wise squaring].
Definition at line 1255 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), RegressionTree::BuildTree(), kaldi::ClusterGaussiansToUbm(), BasisFmllrEstimate::ComputeAmDiagPrecond(), SvdApplier::DecomposeComponent(), kaldi::DiagGmmToStats(), kaldi::EBWUpdateGaussian(), kaldi::GetFeatureMeanAndVariance(), kaldi::InitGmmFromRandomFrames(), main(), DiagGmm::merged_components_logdet(), DiagGmm::MergeKmeans(), kaldi::SlidingWindowCmnInternal(), kaldi::UnitTestAddVecCross(), UnitTestEstimateDiagGmm(), and kaldi::UnitTestEstimateMmieDiagGmm().
void AddVec2 | ( | const Real | alpha, |
const VectorBase< OtherReal > & | v | ||
) |
Add vector : *this = *this + alpha * rv^2 [element-wise squaring], with casting between floats and doubles.
Definition at line 1065 of file kaldi-vector.cc.
void AddVecDivVec | ( | Real | alpha, |
const VectorBase< Real > & | v, | ||
const VectorBase< Real > & | r, | ||
Real | beta | ||
) |
Add element-by-element quotient of two vectors.
this <—- alpha*v/r + beta*this
Definition at line 1034 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), main(), and kaldi::UnitTestSimpleForVec().
void AddVecVec | ( | Real | alpha, |
const VectorBase< Real > & | v, | ||
const VectorBase< Real > & | r, | ||
Real | beta | ||
) |
Add element-by-element product of vectors:
Definition at line 1000 of file kaldi-vector.cc.
Referenced by FmllrRawAccs::AccumulateFromPosteriors(), VectorBase< float >::ApplyPow(), MleAmSgmm2Accs::CommitStatsForSpk(), kaldi::ComputeAmGmmFeatureDeriv(), kaldi::ComputeLocalCost(), OptimizeLbfgs< Real >::ComputeNewDirection(), kaldi::CuVectorUnitTestAddVecVec(), kaldi::ExtendWaveWithSilence(), kaldi::GetFeatDeriv(), and BatchNormComponent::Info().
void ApplyAbs | ( | ) |
Take absolute value of each of the elements.
Definition at line 807 of file kaldi-vector.cc.
Referenced by kaldi::CuVectorUnitTestSum(), kaldi::nnet3::PrintPriorDiagnostics(), kaldi::nnet2::PrintPriorDiagnostics(), VectorBase< float >::Range(), and kaldi::UnitTestTopEigs().
|
inline |
Applies ceiling to all elements.
Returns number of elements changed in ceiled_count if it is non-null.
Definition at line 155 of file kaldi-vector.h.
Referenced by kaldi::CuVectorUnitTestApplyCeiling(), FeatureTransformEstimate::EstimateInternal(), and kaldi::UnitTestFloorCeiling().
void ApplyExp | ( | ) |
Apply exponential to each value in vector.
Definition at line 800 of file kaldi-vector.cc.
Referenced by ComputeLogPosteriors(), kaldi::nnet2::ComputeObjfAndGradient(), IvectorExtractor::GetAcousticAuxfWeight(), VectorBase< float >::Range(), kaldi::nnet2::ShrinkNnet(), kaldi::nnet3::TestNnetDecodable(), kaldi::nnet2::UnitTestAmNnet(), kaldi::nnet2::UnitTestNnetDecodable(), kaldi::UnitTestPosteriors(), MleAmSgmm2Updater::UpdatePhoneVectorsInternal(), MleAmSgmm2Updater::UpdateWGetStats(), and MleSgmm2SpeakerAccs::UpdateWithU().
|
inline |
Applies floor to all elements.
Returns number of elements floored in floored_count if it is non-null.
Definition at line 149 of file kaldi-vector.h.
Referenced by VectorBase< float >::ApplyCeiling(), Plda::ApplyTransform(), SpectrogramComputer::Compute(), FbankComputer::Compute(), AmSgmm2::ComputeFmllrPreXform(), kaldi::ComputeNormalizingTransform(), kaldi::CuVectorUnitTestApplyFloor(), PldaEstimator::GetOutput(), BatchNormComponent::Info(), NonlinearComponent::Info(), IvectorExtractor::InvertWithFlooring(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditioner::PreconditionDirectionsInternal(), OnlineNaturalGradient::PreconditionDirectionsInternal(), kaldi::SlidingWindowCmnInternal(), kaldi::SolveQuadraticMatrixProblem(), kaldi::SolveQuadraticProblem(), SpMatrix< float >::SymPosSemiDefEig(), kaldi::UnitTestCuDiffNormalizePerRow(), kaldi::UnitTestFloorCeiling(), IvectorExtractorStats::UpdatePrior(), MleAmSgmm2Updater::UpdateVars(), and NonlinearComponent::Write().
MatrixIndexT ApplyFloor | ( | const VectorBase< Real > & | floor_vec | ) |
Applies floor to all elements. Returns number of elements floored.
Definition at line 854 of file kaldi-vector.cc.
void ApplyLog | ( | ) |
Apply natural log to all elements.
Throw if any element of the vector is negative (but doesn't complain about zero; the log will be -infinity
Definition at line 783 of file kaldi-vector.cc.
Referenced by AmSgmm2::ComponentLogLikes(), FbankComputer::Compute(), kaldi::FrameLevelLpp(), IvectorExtractor::GetAcousticAuxfWeight(), PdfPrior::PdfPrior(), VectorBase< float >::Range(), LogisticRegression::ScalePriors(), and MleSgmm2SpeakerAccs::UpdateWithU().
void ApplyLogAndCopy | ( | const VectorBase< Real > & | v | ) |
Apply natural log to another vector and put result in *this.
Definition at line 792 of file kaldi-vector.cc.
Referenced by VectorBase< float >::Range(), and kaldi::UnitTestSimple().
Real ApplyLogSoftMax | ( | ) |
Applies log soft-max to vector and returns normalizer (log sum of exponentials).
This is the same as:
Definition at line 877 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyCeiling(), and kaldi::UnitTestSimpleForVec().
|
inline |
Take all elements of vector to a power.
Definition at line 179 of file kaldi-vector.h.
Referenced by AccumDiagGmm::AccumulateForComponent(), AccumDiagGmm::AccumulateFromPosteriors(), SpMatrix< float >::ApplyFloor(), SpMatrix< float >::ApplyPow(), DiagGmm::ComponentLogLikelihood(), FbankComputer::Compute(), PlpComputer::Compute(), OnlinePreconditioner::ComputeEt(), OnlineNaturalGradient::ComputeEt(), kaldi::ComputeNormalizingTransform(), kaldi::CuVectorUnitTestApplyPow(), Plda::GetNormalizationFactor(), BatchNormComponent::Info(), NonlinearComponent::Info(), Plda::LogLikelihoodRatio(), DiagGmm::LogLikelihoods(), main(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlinePreconditioner::PreconditionDirectionsInternal(), OnlineNaturalGradient::PreconditionDirectionsInternal(), kaldi::SlidingWindowCmnInternal(), Plda::SmoothWithinClassCovariance(), kaldi::SolveQuadraticMatrixProblem(), kaldi::SolveQuadraticProblem(), MatrixBase< float >::SymPosSemiDefEig(), UnitTestEstimateDiagGmm(), kaldi::UnitTestEstimateMmieDiagGmm(), kaldi::UnitTestPower(), IvectorExtractorStats::UpdatePrior(), and NonlinearComponent::Write().
void ApplyPowAbs | ( | Real | power, |
bool | include_sign = false |
||
) |
Take the absolute value of all elements of a vector to a power.
Include the sign of the input element if include_sign == true. If power is negative and the input value is zero, the output is set zero.
Definition at line 479 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), and kaldi::UnitTestPowerAbs().
Real ApplySoftMax | ( | ) |
Apply soft-max to vector and return normalizer (log sum of exponentials).
This is the same as:
Definition at line 867 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyCeiling(), Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), IvectorExtractorStats::CommitStatsForWPoint(), FullGmm::ComponentPosteriors(), DiagGmm::ComponentPosteriors(), AmSgmm2::ComputeFmllrPreXform(), kaldi::CuVectorUnitTestApplySoftMax(), IvectorExtractor::GetIvectorDistWeight(), main(), and EbwAmSgmm2Updater::UpdatePhoneVectorsInternal().
bool ApproxEqual | ( | const VectorBase< Real > & | other, |
float | tol = 0.01 |
||
) | const |
Returns true if ((*this)-other).Norm(2.0) <= tol * (*this).Norm(2.0).
Definition at line 556 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), kaldi::ApproxEqual(), AccumDiagGmm::AssertEqual(), kaldi::AssertEqual(), kaldi::CuVectorUnitTestCopyDiagFromPacked(), FmllrRawAccs::DataHasChanged(), FmllrDiagGmmAccs::DataHasChanged(), and kaldi::UnitTestNorm().
void Ceiling | ( | const VectorBase< Real > & | v, |
Real | ceil_val, | ||
MatrixIndexT * | ceiled_count = nullptr |
||
) |
Applies ceiling to all elements.
Returns number of elements changed in ceiled_count if it is non-null.
Definition at line 833 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyCeiling(), and VectorBase< float >::Range().
template void CopyColFromMat | ( | const MatrixBase< OtherReal > & | M, |
MatrixIndexT | col | ||
) |
Extracts a column of the matrix M.
Definition at line 656 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), kaldi::ComputeVadEnergy(), kaldi::generate_features(), kaldi::IncreaseTransformDimension(), main(), kaldi::TestOnlineLdaInput(), TestSgmm2PreXform(), kaldi::UnitTestAddDiagVecMat(), kaldi::UnitTestRow(), kaldi::UnitTestSimpleForVec(), kaldi::UnitTestSnipEdges(), and kaldi::UnitTestSpliceRows().
void CopyColsFromMat | ( | const MatrixBase< Real > & | M | ) |
Performs a column stack of the matrix M.
Definition at line 390 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), and kaldi::UnitTestSpliceRows().
void CopyDiagFromMat | ( | const MatrixBase< Real > & | M | ) |
Extracts the diagonal of the matrix M.
Definition at line 674 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), kaldi::CuVectorUnitTestCopyDiagFromMat(), kaldi::UnitTestAddDiagMat2(), kaldi::UnitTestAddDiagMatMat(), kaldi::UnitTestSpliceRows(), and kaldi::UnitTestTopEigs().
void CopyDiagFromPacked | ( | const PackedMatrix< Real > & | M | ) |
Extracts the diagonal of a packed matrix M; works for Sp or Tp.
Definition at line 680 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), VectorBase< float >::CopyDiagFromSp(), VectorBase< float >::CopyDiagFromTp(), DiagGmm::CopyFromFullGmm(), kaldi::CuVectorUnitTestCopyDiagFromPacked(), and SpMatrix< float >::Eig().
|
inline |
Extracts the diagonal of a symmetric matrix.
Definition at line 309 of file kaldi-vector.h.
Referenced by kaldi::SolveQuadraticMatrixProblem(), kaldi::SolveQuadraticProblem(), and SpMatrix< float >::TopEigs().
|
inline |
Extracts the diagonal of a triangular matrix.
Definition at line 312 of file kaldi-vector.h.
template void CopyFromPacked | ( | const PackedMatrix< OtherReal > & | M | ) |
Copy data from a SpMatrix or TpMatrix (must match own size).
Definition at line 237 of file kaldi-vector.cc.
Referenced by VectorBase< float >::Range().
|
protected |
Load data into the vector: sz must match own size.
Load data into the vector.
Definition at line 249 of file kaldi-vector.cc.
Referenced by VectorBase< float >::VectorBase().
void CopyFromVec | ( | const VectorBase< Real > & | v | ) |
Copy data from another vector (must match own size).
Copy data from another vector.
Definition at line 228 of file kaldi-vector.cc.
Referenced by OptimizeLbfgs< Real >::AcceptStep(), RegtreeMllrDiagGmmAccs::AccumulateForGaussian(), RegtreeMllrDiagGmmAccs::AccumulateForGmm(), AccumFullGmm::AccumulateFromPosteriors(), BatchedXvectorComputer::AddChunkToBatch(), kaldi::ApplyAffineTransform(), Fmpe::ApplyC(), Plda::ApplyTransform(), kaldi::ClusterGaussiansToUbm(), kaldi::nnet2::CombineNnets(), kaldi::nnet2::CombineNnetsA(), FullGmm::ComponentPosteriors(), DiagGmm::ComponentPosteriors(), SpectrogramComputer::Compute(), kaldi::ComputeAndSubtractMean(), OnlinePreconditioner::ComputeEt(), OnlineNaturalGradient::ComputeEt(), kaldi::ComputeFeatureNormalizingTransform(), OnlineGenericBaseFeature< C >::ComputeFeatures(), OnlineLdaInput::ComputeNextRemainder(), EbwAmSgmm2Updater::ComputePhoneVecStats(), OnlineCmvn::ComputeStatsForFrame(), LstmNonlinearityComponent::ConsolidateMemory(), FmllrRawAccs::ConvertToSimpleStats(), kaldi::ConvolveSignals(), DiagGmmNormal::CopyFromDiagGmm(), FullGmmNormal::CopyFromFullGmm(), CuVectorBase< float >::CopyToVec(), kaldi::CuVectorUnitTestCopyCross2(), DiscriminativeExampleSplitter::DoExcise(), kaldi::EBWUpdateGaussian(), DecodableNnetSimple::EnsureFrameIsComputed(), OnlinePitchFeatureImpl::ExtractFrame(), kaldi::ExtractObjectRange(), kaldi::ExtractRowRangeWithPadding(), kaldi::FFTbasedBlockConvolveSignals(), kaldi::FFTbasedConvolveSignals(), kaldi::FilterMatrixRows(), FullGmm::GetComponentMean(), FullGmm::GetCovarsAndMeans(), kaldi::GetFeatureMeanAndVariance(), OnlineGenericBaseFeature< C >::GetFrame(), OnlineMatrixFeature::GetFrame(), OnlineIvectorFeature::GetFrame(), OnlineTransform::GetFrame(), OnlineCacheFeature::GetFrame(), IvectorExtractor::GetIvectorDistribution(), RegtreeFmllrDiagGmm::GetLogDets(), LogisticRegression::GetLogPosteriors(), FullGmm::GetMeans(), LogisticRegression::GetObjfAndGrad(), DecodableNnetSimple::GetOutputForFrame(), DecodableNnetSimpleLooped::GetOutputForFrame(), SentenceAveragingComponent::GetParams(), OnlineCmvn::GetState(), AmSgmm2::GetSubstateMean(), AmSgmm2::GetVarScaledSubstateSpeakerMean(), kaldi::IsmoothStatsDiagGmm(), IvectorExtractor::IvectorExtractor(), kaldi::LinearCgd(), FullGmm::LogLikelihoods(), DiagGmm::LogLikelihoods(), DiagGmm::LogLikelihoodsPreselect(), main(), DiagGmm::merged_components_logdet(), FullGmm::MergedComponentsLogdet(), DiagGmm::MergeKmeans(), SoftmaxComponent::MixUp(), Vector< float >::operator=(), OnlineCmnInput::OutputFrame(), OnlinePreconditionerSimple::PreconditionDirections(), OnlineNaturalGradientSimple::PreconditionDirections(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), kaldi::nnet3::ProcessFile(), kaldi::nnet2::ProcessFile(), FullGmmNormal::Rand(), VectorBase< float >::Range(), OnlineVectorSource::Read(), kaldi::RealFftInefficient(), OptimizeLbfgs< Real >::Restart(), kaldi::ReverseFrames(), kaldi::nnet3::RunNnetComputation(), DiagGmm::SetComponentInvVar(), FullGmm::SetInvCovars(), kaldi::SlidingWindowCmnInternal(), kaldi::SolveQuadraticProblem(), OnlineLdaInput::SpliceFrames(), SpMatrix< float >::TopEigs(), Plda::TransformIvector(), kaldi::UnitTestAddDiagVecMat(), kaldi::UnitTestComplexFft(), kaldi::UnitTestCuVectorCopyFromVec(), kaldi::UnitTestDiagGmm(), UnitTestEstimateLda(), UnitTestFullGmm(), kaldi::UnitTestIoCross(), kaldi::UnitTestPower(), kaldi::UnitTestPowerAbs(), UnitTestReadWave(), kaldi::UnitTestRealFft(), kaldi::UnitTestRegtreeFmllrDiagGmm(), kaldi::UnitTestSimpleForVec(), kaldi::UnitTestSplitRadixComplexFft(), kaldi::UnitTestSplitRadixComplexFft2(), kaldi::UnitTestSplitRadixRealFft(), kaldi::UnitTestSubvector(), FmllrRawAccs::Update(), kaldi::UpdateEbwDiagGmm(), kaldi::UpdateEbwWeightsDiagGmm(), MleSgmm2SpeakerAccs::UpdateNoU(), PldaUnsupervisedAdaptor::UpdatePlda(), IvectorExtractorStats::UpdateProjection(), IvectorExtractorStats::UpdateVariances(), IvectorExtractorStats::UpdateWeight(), MleSgmm2SpeakerAccs::UpdateWithU(), Vector< float >::Vector(), ConstantComponent::Vectorize(), PerElementScaleComponent::Vectorize(), PerElementOffsetComponent::Vectorize(), ConstantFunctionComponent::Vectorize(), and NonlinearComponent::Write().
void CopyFromVec | ( | const VectorBase< OtherReal > & | v | ) |
Copy data from another vector of different type (double vs. float)
Definition at line 256 of file kaldi-vector.cc.
void CopyFromVec | ( | const CuVectorBase< OtherReal > & | v | ) |
Copy from CuVector. This is defined in ../cudamatrix/cu-vector.h.
Definition at line 383 of file cu-vector.h.
void CopyRowFromMat | ( | const MatrixBase< Real > & | M, |
MatrixIndexT | row | ||
) |
Extracts a row of the matrix M.
Could also do this with this->Copy(M[row]).
Definition at line 407 of file kaldi-vector.cc.
Referenced by RegtreeFmllrDiagGmmAccs::AccumulateForGaussian(), RegtreeFmllrDiagGmmAccs::AccumulateForGmm(), VectorBase< float >::ApplyPow(), DiagGmm::GetComponentMean(), DiagGmm::GetComponentVariance(), LdaEstimate::GetStats(), main(), UnitTestEstimateDiagGmm(), kaldi::UnitTestEstimateMmieDiagGmm(), kaldi::UnitTestPosteriors(), kaldi::UnitTestRow(), and kaldi::UnitTestSpliceRows().
void CopyRowFromMat | ( | const MatrixBase< OtherReal > & | M, |
MatrixIndexT | row | ||
) |
Extracts a row of the matrix M with type conversion.
Definition at line 416 of file kaldi-vector.cc.
template void CopyRowFromSp | ( | const SpMatrix< OtherReal > & | S, |
MatrixIndexT | row | ||
) |
Extracts a row of the symmetric matrix S.
Definition at line 431 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), and CompressedAffineXformStats::CopyFromAffineXformStats().
void CopyRowsFromMat | ( | const MatrixBase< Real > & | M | ) |
Performs a row stack of the matrix M.
Definition at line 348 of file kaldi-vector.cc.
Referenced by BasisFmllrAccus::AccuGradientScatter(), FmllrSgmm2Accs::AccumulateForFmllrSubspace(), VectorBase< float >::ApplyPow(), LstmNonlinearityComponent::ConsolidateMemory(), kaldi::CuVectorUnitTestCopyFromMat(), FmllrRawAccs::GetAuxf(), LinearTransform::GetGradient(), LinearTransform::GetParams(), kaldi::nnet1::MomentStatistics(), LogisticRegression::TrainParameters(), kaldi::UnitTestSpliceRows(), LstmNonlinearityComponent::Vectorize(), and LinearComponent::Vectorize().
void CopyRowsFromMat | ( | const MatrixBase< OtherReal > & | M | ) |
Definition at line 368 of file kaldi-vector.cc.
void CopyRowsFromMat | ( | const CuMatrixBase< Real > & | M | ) |
The following is implemented in ../cudamatrix/cu-matrix.cc.
Definition at line 2621 of file cu-matrix.cc.
|
inline |
Returns a pointer to the start of the vector's data.
Definition at line 70 of file kaldi-vector.h.
Referenced by kaldi::AccCmvnStats(), SpMatrix< float >::AddDiagVec(), MatrixBase< float >::AddDiagVecMat(), SpMatrix< float >::AddMat2Sp(), SpMatrix< float >::AddMat2Vec(), MatrixBase< float >::AddMatDiagVec(), VectorBase< float >::AddMatSvec(), VectorBase< float >::AddMatVec(), kaldi::AddOuterProductPlusMinus(), VectorBase< float >::AddSpVec(), SparseVector< Real >::AddToVec(), VectorBase< float >::AddVec(), SpMatrix< float >::AddVec2(), SpMatrix< float >::AddVec2Sp(), MatrixBase< float >::AddVecToCols(), MatrixBase< float >::AddVecToRows(), MatrixBase< float >::AddVecVec(), SpMatrix< float >::AddVecVec(), kaldi::ComplexFft(), kaldi::ComplexFftRecursive(), kaldi::ComplexFt(), kaldi::nnet3::ComponentDotProducts(), SpectrogramComputer::Compute(), MfccComputer::Compute(), FbankComputer::Compute(), PlpComputer::Compute(), PitchFrameInfo::ComputeBacktraces(), OnlinePreconditioner::ComputeEt(), OnlineNaturalGradient::ComputeEt(), kaldi::ComputeLpc(), kaldi::ComputeVadEnergy(), MatrixBase< float >::CopyColFromVec(), MatrixBase< float >::CopyColsFromVec(), CompressedMatrix::CopyColToVec(), MatrixBase< float >::CopyDiagFromVec(), SparseVector< Real >::CopyElementsToVec(), SparseMatrix< float >::CopyElementsToVec(), CuVectorBase< float >::CopyFromVec(), PackedMatrix< float >::CopyFromVec(), VectorBase< float >::CopyFromVec(), MatrixBase< float >::CopyRowFromVec(), MatrixBase< float >::CopyRowsFromVec(), CuMatrixBase< float >::CopyRowsFromVec(), CompressedMatrix::CopyRowToVec(), CuVectorBase< float >::CopyToVec(), kaldi::Dither(), VectorBase< float >::DivElements(), OnlineSpeexEncoder::Encode(), kaldi::FFTbasedBlockConvolveSignals(), kaldi::FFTbasedConvolveSignals(), FullGmm::GaussianSelection(), DiagGmm::GaussianSelection(), AmSgmm2::GaussianSelection(), FullGmm::GaussianSelectionPreselect(), DiagGmm::GaussianSelectionPreselect(), OnlineCmvn::GetFrame(), MatrixBase< float >::LapackGesvd(), SoftmaxComponent::MixUp(), VectorBase< float >::MulElements(), SpMatrix< float >::Qr(), kaldi::nnet3::ReadVectorAsChar(), kaldi::RealFft(), kaldi::SelectLags(), SparseVector< Real >::SparseVector(), AmSgmm2::SplitSubstatesInGroup(), SubVector< Real >::SubVector(), kaldi::nnet3::SummarizeVector(), SpMatrix< float >::Tridiagonalize(), kaldi::UnitTestEigSp(), kaldi::UnitTestPldaEstimation(), kaldi::UnitTestSimpleForMat(), kaldi::UnitTestSplitRadixComplexFft(), kaldi::UnitTestSplitRadixRealFft(), kaldi::UnitTestSplitRadixRealFftSpeed(), kaldi::UnitTestTopEigs(), kaldi::VecSpVec(), kaldi::VecSvec(), VectorBase< float >::VectorBase(), kaldi::VecVec(), kaldi::nnet3::WriteVectorAsChar(), and kaldi::nnet3::time_height_convolution::ZeroBlankRows().
|
inline |
Returns a pointer to the start of the vector's data (const).
Definition at line 73 of file kaldi-vector.h.
|
inline |
Returns the dimension of the vector.
Definition at line 64 of file kaldi-vector.h.
Referenced by kaldi::AccCmvnStats(), kaldi::AccCmvnStatsWrapper(), OnlineSpeexDecoder::AcceptSpeexBits(), OnlineSpeexEncoder::AcceptWaveform(), OnlineGenericBaseFeature< C >::AcceptWaveform(), SingleUtteranceNnet2DecoderThreaded::AcceptWaveform(), OnlinePitchFeatureImpl::AcceptWaveform(), NnetLdaStatsAccumulator::AccStatsFromOutput(), LdaEstimate::Accumulate(), AccumFullGmm::AccumulateForComponent(), AccumDiagGmm::AccumulateForComponent(), FmllrRawAccs::AccumulateForGmm(), kaldi::AccumulateForUtterance(), AccumDiagGmm::AccumulateFromDiag(), MlltAccs::AccumulateFromPosteriors(), AccumFullGmm::AccumulateFromPosteriors(), AccumDiagGmm::AccumulateFromPosteriors(), MleAmSgmm2Accs::AccumulateFromPosteriors(), MleSgmm2SpeakerAccs::AccumulateFromPosteriors(), FmllrDiagGmmAccs::AccumulateFromPosteriorsPreselect(), RestrictedAttentionComponent::Add(), VectorRandomizer::AddData(), SpMatrix< float >::AddDiagVec(), MatrixBase< float >::AddDiagVecMat(), SpMatrix< float >::AddMat2Vec(), MatrixBase< float >::AddMatDiagVec(), Nnet::AddNnet(), kaldi::nnet3::AddNnetComponents(), kaldi::AddNoise(), kaldi::AddOuterProductPlusMinus(), PldaUnsupervisedAdaptor::AddStats(), SparseVector< Real >::AddToVec(), SpMatrix< float >::AddVec2(), SpMatrix< float >::AddVec2Sp(), MatrixBase< float >::AddVecToCols(), MatrixBase< float >::AddVecToRows(), kaldi::AddVectorsOfUnequalLength(), kaldi::AddVectorsWithOffset(), MatrixBase< float >::AddVecVec(), SpMatrix< float >::AddVecVec(), DecodableNnetSimpleLooped::AdvanceChunk(), kaldi::AppendVector(), kaldi::AppendVectorToFeats(), kaldi::ApplyAffineTransform(), VectorBase< float >::ApplyFloor(), SpMatrix< float >::ApplyFloor(), ApplyFmllrXform(), VectorBase< float >::ApplyLogAndCopy(), Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), AssertEqual(), MleAmSgmm2Accs::Check(), IvectorExtractorStats::CheckDims(), MleSgmm2SpeakerAccs::Clear(), kaldi::nnet2::CombineNnets(), kaldi::nnet2::CombineNnetsA(), IvectorExtractorStats::CommitStatsForM(), MleAmSgmm2Accs::CommitStatsForSpk(), kaldi::ComplexFft(), kaldi::ComplexFftRecursive(), kaldi::ComplexFt(), kaldi::nnet3::ComponentDotProducts(), Nnet::ComponentDotProducts(), FullGmm::ComponentLogLikelihood(), DiagGmm::ComponentLogLikelihood(), AmSgmm2::ComponentLogLikes(), DiagGmm::ComponentPosteriors(), SpectrogramComputer::Compute(), MelBanks::Compute(), MfccComputer::Compute(), FbankComputer::Compute(), OfflineFeatureTpl< F >::Compute(), PlpComputer::Compute(), kaldi::nnet3::ComputeAccuracy(), kaldi::ComputeAndProcessKaldiPitch(), PitchFrameInfo::ComputeBacktraces(), kaldi::ComputeEarlyReverbEnergy(), OnlinePreconditioner::ComputeEt(), OnlineNaturalGradient::ComputeEt(), AmSgmm2::ComputeFmllrPreXform(), AmSgmm2::ComputeGammaI(), kaldi::ComputeGconsts(), AmSgmm2::ComputeHsmFromModel(), kaldi::ComputeKaldiPitch(), kaldi::ComputeKaldiPitchFirstPass(), kaldi::ComputeLifterCoeffs(), kaldi::ComputeLocalCost(), kaldi::ComputeLpc(), kaldi::ComputeNccf(), kaldi::nnet2::ComputeObjfAndGradient(), kaldi::ComputePowerSpectrum(), OnlinePreconditioner::ComputeWt1(), OnlineNaturalGradient::ComputeWt1(), OnlinePreconditioner::ComputeZt(), OnlineNaturalGradient::ComputeZt(), MatrixBase< float >::Cond(), LstmNonlinearityComponent::ConsolidateMemory(), kaldi::ConvolveSignals(), MatrixBase< float >::CopyColFromVec(), MatrixBase< float >::CopyColsFromVec(), CompressedMatrix::CopyColToVec(), MatrixBase< float >::CopyDiagFromVec(), SparseVector< Real >::CopyElementsToVec(), SparseMatrix< float >::CopyElementsToVec(), CuVectorBase< float >::CopyFromVec(), PackedMatrix< float >::CopyFromVec(), VectorBase< float >::CopyFromVec(), MatrixBase< float >::CopyRowFromVec(), MatrixBase< float >::CopyRowsFromVec(), CuMatrixBase< float >::CopyRowsFromVec(), CompressedMatrix::CopyRowToVec(), DiagGmmNormal::CopyToDiagGmm(), FullGmmNormal::CopyToFullGmm(), CuVectorBase< float >::CopyToVec(), kaldi::nnet1::CountCorrectFramesWeighted(), kaldi::cu::CpuBackpropLstmNonlinearity(), kaldi::CreateEigenvalueMatrix(), CuVector< float >::CuVector(), FmllrRawAccs::DataHasChanged(), FmllrDiagGmmAccs::DataHasChanged(), OnlineSpeexDecoder::Decode(), DeltaFeatures::DeltaFeatures(), MatrixBase< float >::DestructiveSvd(), kaldi::Dither(), VectorBase< float >::DivElements(), DecodableNnetSimple::DoNnetComputation(), kaldi::EBWUpdateGaussian(), SpMatrix< float >::Eig(), kaldi::ElementwiseProductOfFft(), OnlineSpeexEncoder::Encode(), SingleUtteranceGmmDecoder::EstimateFmllr(), FeatureTransformEstimate::EstimateInternal(), kaldi::EstimateSgmm2FmllrSubspace(), kaldi::EstPca(), Xent::Eval(), Mse::Eval(), kaldi::ExtendWaveWithSilence(), OnlinePitchFeatureImpl::ExtractFrame(), kaldi::ExtractObjectRange(), kaldi::ExtractWindow(), kaldi::FFTbasedBlockConvolveSignals(), kaldi::FFTbasedConvolveSignals(), kaldi::FindQuietestSegment(), kaldi::FrameLevelLpp(), AmSgmm2::GaussianSelection(), DiagGmm::Generate(), FullGmm::GetComponentMean(), DiagGmm::GetComponentMean(), DiagGmm::GetComponentVariance(), kaldi::GetFeatureMeanAndVariance(), OnlineIvectorFeature::GetFrame(), OnlineCmvn::GetFrame(), OnlineProcessPitch::GetFrame(), OnlineSpliceFrames::GetFrame(), OnlineDeltaFeature::GetFrame(), OnlinePitchFeatureImpl::GetFrame(), OnlineAppendFeature::GetFrame(), ParametricRelu::GetGradient(), LinearTransform::GetGradient(), AffineTransform::GetGradient(), RecurrentComponent::GetGradient(), ParallelComponent::GetGradient(), LstmProjected::GetGradient(), ConvolutionalComponent::GetGradient(), BlstmProjected::GetGradient(), AddShift::GetGradient(), Rescale::GetGradient(), EigenvalueDecomposition< Real >::GetImagEigenvalues(), OnlineIvectorEstimationStats::GetIvector(), IvectorExtractor::GetIvectorDistribution(), Nnet::GetLearningRates(), RegtreeFmllrDiagGmm::GetLogDets(), LogisticRegression::GetLogPosteriors(), kaldi::GetOccs(), ParametricRelu::GetParams(), LinearTransform::GetParams(), AffineTransform::GetParams(), RecurrentComponent::GetParams(), ParallelComponent::GetParams(), FramePoolingComponent::GetParams(), MultiBasisComponent::GetParams(), LstmProjected::GetParams(), ConvolutionalComponent::GetParams(), SentenceAveragingComponent::GetParams(), BlstmProjected::GetParams(), AddShift::GetParams(), Rescale::GetParams(), IvectorExtractor::GetPriorAuxf(), EigenvalueDecomposition< Real >::GetRealEigenvalues(), SingleUtteranceNnet2DecoderThreaded::GetRemainingWaveform(), kaldi::GetSplitTargets(), AmSgmm2::GetSubstateMean(), AmSgmm2::GetVarScaledSubstateSpeakerMean(), RestrictedAttentionComponent::Info(), FramePoolingComponent::InitData(), InitRand(), kaldi::InitRand(), FmllrRawAccs::InitSingleFrameStats(), OnlineGenericBaseFeature< C >::InputFinished(), kaldi::nnet3::KlDivergence(), kaldi::nnet2::KlDivergence(), MatrixBase< float >::LapackGesvd(), NnetDiscriminativeUpdater::LatticeComputations(), FullGmm::LogLikelihoods(), DiagGmm::LogLikelihoods(), FullGmm::LogLikelihoodsPreselect(), DiagGmm::LogLikelihoodsPreselect(), DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased(), main(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), DiagGmm::merged_components_logdet(), FullGmm::MergedComponentsLogdet(), kaldi::nnet3::MergeSupervision(), SoftmaxComponent::MixUp(), kaldi::MleDiagGmmUpdate(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), kaldi::nnet1::MomentStatistics(), MatrixBase< float >::MulColsVec(), VectorBase< float >::MulElements(), MatrixBase< float >::MulRowsVec(), DiagGmmNormal::NumGauss(), FisherComputationClass::operator()(), CuVector< float >::operator=(), Vector< float >::operator=(), OptimizeLbfgs< Real >::OptimizeLbfgs(), PdfPrior::PdfPrior(), kaldi::Preemphasize(), TransitionModel::Print(), kaldi::nnet3::PrintPriorDiagnostics(), kaldi::nnet2::PrintPriorDiagnostics(), kaldi::nnet3::PrintVectorPerUpdatableComponent(), IvectorExtractorStats::PriorDiagnostics(), DeltaFeatures::Process(), ShiftedDeltaFeatures::Process(), kaldi::ProcessWindow(), kaldi::unittest::RandDiagGaussFeatures(), kaldi::unittest::RandFullGaussFeatures(), OnlineTcpVectorSource::Read(), OnlinePaSource::Read(), MleAmSgmm2Accs::Read(), OnlineVectorSource::Read(), VectorBase< float >::Read(), Vector< float >::Read(), PermuteComponent::Read(), kaldi::ReadData(), kaldi::RealFft(), kaldi::RealFftInefficient(), ArbitraryResample::Resample(), LinearResample::Resample(), DiagGmmNormal::Resize(), FullGmmNormal::Resize(), Sgmm2PerFrameDerivedVars::Resize(), Nnet::ScaleComponents(), DiagGmm::SetComponentInvVar(), DiagGmm::SetComponentMean(), ArbitraryResample::SetIndexes(), Nnet::SetLearningRates(), PitchFrameInfo::SetNccfPov(), Nnet::SetParams(), ParametricRelu::SetParams(), LinearTransform::SetParams(), AffineTransform::SetParams(), RecurrentComponent::SetParams(), ParallelComponent::SetParams(), ConvolutionalComponent::SetParams(), LstmProjected::SetParams(), BlstmProjected::SetParams(), AddShift::SetParams(), Rescale::SetParams(), kaldi::nnet2::SetPriors(), kaldi::nnet3::SetPriors(), AmNnetSimple::SetPriors(), LinearResample::SetRemainder(), Sgmm2PerSpkDerivedVars::SetSpeakerVector(), FullGmm::SetWeights(), DiagGmm::SetWeights(), kaldi::SolveQuadraticProblem(), kaldi::SortSvd(), SparseVector< Real >::SparseVector(), AmSgmm2::SplitSubstates(), NnetBatchComputer::SplitUtteranceIntoTasks(), RestrictedAttentionComponent::StoreStats(), SubVector< Real >::SubVector(), kaldi::nnet3::SummarizeVector(), MatrixBase< float >::SymPosSemiDefEig(), kaldi::nnet3::TestNnetDecodable(), SpMatrix< float >::TopEigs(), RegtreeFmllrDiagGmm::TransformFeature(), Plda::TransformIvector(), kaldi::TypeOneUsage(), kaldi::TypeThreeUsage(), kaldi::TypeTwoUsage(), kaldi::UnitTestCuMatrixSetRandUniform(), kaldi::UnitTestDelay(), UnitTestEstimateLda(), kaldi::UnitTestFFTbasedBlockConvolution(), kaldi::UnitTestFFTbasedConvolution(), UnitTestLinearResample(), UnitTestLinearResample2(), kaldi::UnitTestPieces(), kaldi::UnitTestPldaEstimation(), UnitTestReadWave(), kaldi::UnitTestReplaceValue(), kaldi::UnitTestSetRandUniform(), kaldi::UnitTestSimple(), UnitTestSimple(), kaldi::UnitTestSvdNodestroy(), ConvolutionComponent::UnVectorize(), TimeHeightConvolutionComponent::UnVectorize(), LstmNonlinearityComponent::UnVectorize(), AffineComponent::UnVectorize(), TdnnComponent::UnVectorize(), BlockAffineComponent::UnVectorize(), RepeatedAffineComponent::UnVectorize(), LinearComponent::UnVectorize(), CompositeComponent::UnVectorize(), kaldi::nnet3::UnVectorizeNnet(), MleSgmm2SpeakerAccs::Update(), kaldi::nnet3::UpdateNnetWithMaxChange(), MleSgmm2SpeakerAccs::UpdateNoU(), OnlinePitchFeatureImpl::UpdateRemainder(), EbwAmSgmm2Updater::UpdateSubstateWeights(), MleSgmm2SpeakerAccs::UpdateWithU(), kaldi::VecMatVec(), kaldi::VecSpVec(), kaldi::VecSvec(), Vector< float >::Vector(), ConvolutionComponent::Vectorize(), TimeHeightConvolutionComponent::Vectorize(), LstmNonlinearityComponent::Vectorize(), AffineComponent::Vectorize(), TdnnComponent::Vectorize(), BlockAffineComponent::Vectorize(), RepeatedAffineComponent::Vectorize(), LinearComponent::Vectorize(), CompositeComponent::Vectorize(), kaldi::nnet3::VectorizeNnet(), kaldi::VectorToPosteriorEntry(), kaldi::VecVec(), AccumDiagGmm::Write(), and kaldi::nnet3::WriteVectorAsChar().
void DivElements | ( | const VectorBase< Real > & | v | ) |
Divide element-by-element by a vector.
Definition at line 1011 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), DiagGmm::GetComponentMean(), main(), and kaldi::SolveQuadraticProblem().
void DivElements | ( | const VectorBase< OtherReal > & | v | ) |
Divide element-by-element by a vector of different type.
Definition at line 1020 of file kaldi-vector.cc.
void Floor | ( | const VectorBase< Real > & | v, |
Real | floor_val, | ||
MatrixIndexT * | floored_count = nullptr |
||
) |
Applies floor to all elements.
Returns number of elements floored in floored_count if it is non-null.
Definition at line 812 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyFloor(), and VectorBase< float >::Range().
void InvertElements | ( | ) |
Invert all elements.
Definition at line 776 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), OnlinePreconditioner::ComputeEt(), OnlineNaturalGradient::ComputeEt(), OnlinePreconditioner::ComputeWt1(), OnlineNaturalGradient::ComputeWt1(), DiagGmm::CopyFromFullGmm(), CuMatrixBase< float >::DivRowsVec(), DiagGmm::GetComponentVariance(), kaldi::GetFeatureMeanAndVariance(), Plda::GetNormalizationFactor(), IvectorExtractor::InvertWithFlooring(), Plda::LogLikelihoodRatio(), main(), DiagGmm::MergeKmeans(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), DiagGmm::SetComponentInvVar(), AccumDiagGmm::SmoothStats(), kaldi::SolveQuadraticMatrixProblem(), kaldi::SolveQuadraticProblem(), kaldi::UnitTestCuMatrixDivRowsVec(), and kaldi::UnitTestCuVectorInvertElements().
bool IsZero | ( | Real | cutoff = 1.0e-06 | ) | const |
Returns true if matrix is all zeros.
Definition at line 293 of file kaldi-vector.cc.
Referenced by MleAmSgmm2Accs::Check(), MleAmSgmm2Accs::CommitStatsForSpk(), main(), and kaldi::UnitTestSimpleForVec().
|
protected |
Real LogSumExp | ( | Real | prune = -1.0 | ) | const |
Returns log(sum(exp())) without exp overflow If prune > 0.0, ignores terms less than the max - prune.
[Note: in future, if prune = 0.0, it will take the max. For now, use -1 if you don't want it to prune.]
Definition at line 755 of file kaldi-vector.cc.
Referenced by VectorBase< float >::CopyDiagFromTp(), IvectorExtractor::GetAcousticAuxfWeight(), LogisticRegression::GetLogPosteriors(), FullGmm::LogLikelihood(), DiagGmm::LogLikelihood(), DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased(), main(), kaldi::UnitTestDiagGmm(), UnitTestFullGmm(), MleAmSgmm2Updater::UpdatePhoneVectorsInternal(), MleAmSgmm2Updater::UpdateW(), MleAmSgmm2Updater::UpdateWGetStats(), and MleSgmm2SpeakerAccs::UpdateWithU().
Real Max | ( | ) | const |
Returns the maximum value of any element, or -infinity for the empty vector.
Definition at line 574 of file kaldi-vector.cc.
Referenced by kaldi::nnet3::ComputeAccuracy(), kaldi::ComputeEarlyReverbEnergy(), VectorBase< float >::CopyDiagFromTp(), kaldi::CuVectorUnitTestMax(), OptimizeLbfgs< Real >::DoStep(), FeatureTransformEstimate::EstimateInternal(), kaldi::InitGmmFromRandomFrames(), SpMatrix< float >::LimitCond(), main(), CuVectorBase< float >::Max(), SpMatrix< float >::MaxAbsEig(), kaldi::MaxAbsolute(), kaldi::nnet1::MomentStatistics(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditioner::PreconditionDirectionsInternal(), OnlineNaturalGradient::PreconditionDirectionsInternal(), kaldi::nnet2::PrintPriorDiagnostics(), kaldi::nnet3::PrintPriorDiagnostics(), kaldi::SolveQuadraticMatrixProblem(), kaldi::SolveQuadraticProblem(), SpMatrix< float >::SymPosSemiDefEig(), kaldi::TestVectorToPosteriorEntry(), kaldi::UnitTestMaxAbsEig(), kaldi::UnitTestMaxMin(), kaldi::UnitTestSparseVectorMax(), kaldi::UnitTestVectorMax(), IvectorExtractorStats::UpdatePrior(), and kaldi::VectorToPosteriorEntry().
Real Max | ( | MatrixIndexT * | index | ) | const |
Returns the maximum value of any element, and the associated index.
Error if vector is empty.
Definition at line 592 of file kaldi-vector.cc.
Real Min | ( | ) | const |
Returns the minimum value of any element, or +infinity for the empty vector.
Definition at line 614 of file kaldi-vector.cc.
Referenced by kaldi::ApplyHessianXformToGradient(), kaldi::ApplyInvHessianXformToChange(), Plda::ApplyTransform(), VectorBase< float >::CopyDiagFromTp(), kaldi::CuVectorUnitTestMin(), OptimizeLbfgs< Real >::DoStep(), kaldi::EBWUpdateGaussian(), kaldi::GetFeatureMeanAndVariance(), PldaEstimator::GetOutput(), main(), SpMatrix< float >::MaxAbsEig(), kaldi::MaxAbsolute(), CuVectorBase< float >::Min(), MatrixBase< float >::MinSingularValue(), kaldi::nnet1::MomentStatistics(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), Nnet::SetLearningRates(), SpMatrix< float >::SymPosSemiDefEig(), kaldi::UnitTestFloorUnit(), kaldi::UnitTestMaxAbsEig(), kaldi::UnitTestMaxMin(), kaldi::UnitTestVectorMin(), and IvectorExtractorStats::UpdatePrior().
Real Min | ( | MatrixIndexT * | index | ) | const |
Returns the minimum value of any element, and the associated index.
Error if vector is empty.
Definition at line 632 of file kaldi-vector.cc.
void MulElements | ( | const VectorBase< Real > & | v | ) |
Multiply element-by-element by another vector.
Definition at line 968 of file kaldi-vector.cc.
Referenced by RegtreeMllrDiagGmmAccs::AccumulateForGaussian(), RegtreeMllrDiagGmmAccs::AccumulateForGmm(), VectorBase< float >::ApplyPow(), MfccComputer::Compute(), PlpComputer::Compute(), EbwAmSgmm2Updater::ComputePhoneVecStats(), DiagGmm::MergeKmeans(), kaldi::nnet1::MomentStatistics(), kaldi::ProcessWindow(), kaldi::SlidingWindowCmnInternal(), kaldi::SolveQuadraticProblem(), kaldi::UnitTestSimpleForVec(), and kaldi::UnitTestVector().
void MulElements | ( | const VectorBase< OtherReal > & | v | ) |
Multiply element-by-element by another vector of different type.
Definition at line 985 of file kaldi-vector.cc.
void MulTp | ( | const TpMatrix< Real > & | M, |
const MatrixTransposeType | trans | ||
) |
Multiplies this vector by lower-triangular matrix: *this <– *this *M.
Definition at line 152 of file kaldi-vector.cc.
Referenced by VectorBase< float >::AddTpVec(), VectorBase< float >::ApplyPow(), FullGmm::Perturb(), FullGmm::Split(), kaldi::UnitTestCuVectorMulTp(), and kaldi::UnitTestMulTp().
Real Norm | ( | Real | p | ) | const |
Compute the p-th norm of the vector.
Definition at line 512 of file kaldi-vector.cc.
Referenced by OptimizeLbfgs< Real >::AcceptStep(), VectorBase< float >::ApplyPow(), VectorBase< float >::ApproxEqual(), OptimizeLbfgs< Real >::ComputeHifNeeded(), IvectorExtractor::GetIvectorDistribution(), PldaEstimator::GetOutput(), main(), VectorBase< float >::Norm(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlineIvectorFeature::PrintDiagnostics(), OptimizeLbfgs< Real >::Restart(), Plda::TransformIvector(), kaldi::UnitTestLbfgs(), kaldi::UnitTestLinearCgd(), kaldi::UnitTestNorm(), kaldi::UnitTestSimpleForVec(), IvectorExtractorStats::UpdatePrior(), and IvectorExtractTask::~IvectorExtractTask().
|
inline |
|
inline |
void Pow | ( | const VectorBase< Real > & | v, |
Real | power | ||
) |
Definition at line 468 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), and VectorBase< float >::Range().
MatrixIndexT RandCategorical | ( | ) | const |
This function returns a random index into this vector, chosen with probability proportional to the corresponding element.
Requires that this->Min() >= 0 and this->Sum() > 0.
Definition at line 319 of file kaldi-vector.cc.
Referenced by FullGmmNormal::Rand(), and kaldi::UnitTestRandCategorical().
|
inline |
Returns a sub-vector of a vector (a range of elements).
SubVector
class for details Definition at line 94 of file kaldi-vector.h.
Referenced by OnlineSpeexEncoder::AcceptWaveform(), OnlineGenericBaseFeature< C >::AcceptWaveform(), RegtreeFmllrDiagGmmAccs::AccumulateForGaussian(), RegtreeFmllrDiagGmmAccs::AccumulateForGmm(), FmllrSgmm2Accs::AccumulateFromPosteriors(), kaldi::AddVectorsOfUnequalLength(), kaldi::AddVectorsWithOffset(), kaldi::AppendVector(), Fmpe::ApplyProjection(), Fmpe::ApplyProjectionReverse(), FmllrRawAccs::CommitSingleFrameStats(), FmllrDiagGmmAccs::CommitSingleFrameStats(), MelBanks::Compute(), PlpComputer::Compute(), OnlineFeInput< E >::Compute(), BasisFmllrEstimate::ComputeAmDiagPrecond(), kaldi::ComputeEarlyReverbEnergy(), Sgmm2Project::ComputeLdaTransform(), kaldi::ExtendWaveWithSilence(), OnlinePitchFeatureImpl::ExtractFrame(), kaldi::ExtractObjectRange(), CompressedAffineXformStats::ExtractOneG(), kaldi::ExtractWindow(), kaldi::FFTbasedBlockConvolveSignals(), kaldi::FFTbasedConvolveSignals(), kaldi::FindQuietestSegment(), FmllrDiagGmmAccs::FmllrDiagGmmAccs(), kaldi::FmllrInnerUpdate(), ParametricRelu::GetGradient(), Nnet::GetGradient(), AffineTransform::GetGradient(), RecurrentComponent::GetGradient(), ParallelComponent::GetGradient(), LstmProjected::GetGradient(), ConvolutionalComponent::GetGradient(), BlstmProjected::GetGradient(), IvectorExtractor::GetIvectorDistribution(), Nnet::GetParams(), ParametricRelu::GetParams(), AffineTransform::GetParams(), RecurrentComponent::GetParams(), ParallelComponent::GetParams(), FramePoolingComponent::GetParams(), MultiBasisComponent::GetParams(), LstmProjected::GetParams(), ConvolutionalComponent::GetParams(), BlstmProjected::GetParams(), SingleUtteranceNnet2DecoderThreaded::GetRemainingWaveform(), FramePoolingComponent::InitData(), OnlineSpeexEncoder::InputFinished(), OnlineGenericBaseFeature< C >::InputFinished(), main(), MelBanks::MelBanks(), kaldi::MergeFullGmm(), SoftmaxComponent::MixUp(), kaldi::RealFftInefficient(), Nnet::SetParams(), ParametricRelu::SetParams(), AffineTransform::SetParams(), RecurrentComponent::SetParams(), ParallelComponent::SetParams(), MultiBasisComponent::SetParams(), ConvolutionalComponent::SetParams(), LstmProjected::SetParams(), BlstmProjected::SetParams(), SpMatrix< float >::TopEigs(), kaldi::UnitTestCuVectorSum(), UnitTestLinearResample(), kaldi::UnitTestRange(), UnitTestVectorRandomizer(), ConvolutionComponent::UnVectorize(), TimeHeightConvolutionComponent::UnVectorize(), Nnet::UnVectorize(), TdnnComponent::UnVectorize(), RepeatedAffineComponent::UnVectorize(), AffineComponent::UnVectorize(), BlockAffineComponent::UnVectorize(), ScaleAndOffsetComponent::UnVectorize(), ConvolutionComponent::Vectorize(), TimeHeightConvolutionComponent::Vectorize(), TdnnComponent::Vectorize(), RepeatedAffineComponent::Vectorize(), AffineComponent::Vectorize(), BlockAffineComponent::Vectorize(), and ScaleAndOffsetComponent::Vectorize().
|
inline |
Returns a const sub-vector of a vector (a range of elements).
SubVector
class for details Definition at line 103 of file kaldi-vector.h.
Reads from C++ stream (option to add to existing contents).
Throws exception on failure
Definition at line 1086 of file kaldi-vector.cc.
Referenced by VectorBase< float >::CopyDiagFromTp(), kaldi::operator>>(), and Vector< float >::~Vector().
void ReplaceValue | ( | Real | orig, |
Real | changed | ||
) |
Set each element to y = (x == orig ? changed : x).
Definition at line 976 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), kaldi::UnitTestCuVectorReplaceValue(), and kaldi::UnitTestReplaceValue().
void Scale | ( | Real | alpha | ) |
Multiplies all elements by this constant.
Definition at line 963 of file kaldi-vector.cc.
Referenced by FmllrSgmm2Accs::AccumulateForFmllrSubspace(), FmllrDiagGmmAccs::AccumulateForGmm(), FmllrRawAccs::AccumulateForGmm(), RegtreeMllrDiagGmmAccs::AccumulateForGmm(), RegtreeFmllrDiagGmmAccs::AccumulateForGmm(), AccumAmDiagGmm::AccumulateForGmmTwofeats(), kaldi::AddNoise(), kaldi::AlignUtteranceWrapper(), VectorBase< float >::ApplyPow(), RegressionTree::BuildTree(), kaldi::ClusterGaussiansToUbm(), PlpComputer::Compute(), kaldi::ComputeAmGmmFeatureDeriv(), Fmpe::ComputeC(), kaldi::ComputeFeatureNormalizingTransform(), AmSgmm2::ComputeFmllrPreXform(), EbwAmSgmm2Updater::ComputePhoneVecStats(), LstmNonlinearityComponent::ConsolidateMemory(), FmllrRawAccs::ConvertToSimpleStats(), kaldi::CuVectorUnitTestScale(), DeltaFeatures::DeltaFeatures(), MatrixBase< float >::DestructiveSvd(), kaldi::EBWUpdateGaussian(), BasisFmllrEstimate::EstimateFmllrBasis(), kaldi::EstPca(), kaldi::FFTbasedBlockConvolveSignals(), kaldi::FFTbasedConvolveSignals(), kaldi::FmllrInnerUpdate(), kaldi::GenRandStats(), IvectorExtractor::GetAcousticAuxfVariance(), kaldi::GetFeatDeriv(), kaldi::GetFeatureMeanAndVariance(), SingleUtteranceGmmDecoder::GetGaussianPosteriors(), PldaEstimator::GetOutput(), LdaEstimate::GetStats(), BatchNormComponent::Info(), LstmNonlinearityComponent::Info(), NonlinearComponent::Info(), ConstantComponent::InitFromConfig(), ConstantFunctionComponent::InitFromConfig(), kaldi::unittest::InitRandDiagGmm(), kaldi::unittest::InitRandFullGmm(), kaldi::InitRandomGmm(), kaldi::IsmoothStatsDiagGmm(), main(), kaldi::MapDiagGmmUpdate(), FullGmm::Merge(), DiagGmm::merged_components_logdet(), FullGmm::MergedComponentsLogdet(), DiagGmm::MergeKmeans(), kaldi::MleDiagGmmUpdate(), kaldi::MleFullGmmUpdate(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), VectorBase< float >::Norm(), PdfPrior::PdfPrior(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditioner::PreconditionDirectionsInternal(), OnlineNaturalGradient::PreconditionDirectionsInternal(), DiscriminativeObjectiveInfo::Print(), IvectorExtractorStats::PriorDiagnostics(), rand_diag_gmm(), kaldi::RealFft(), LdaEstimate::Scale(), AccumFullGmm::Scale(), AccumDiagGmm::Scale(), RestrictedAttentionComponent::Scale(), kaldi::SlidingWindowCmnInternal(), AccumDiagGmm::SmoothStats(), kaldi::TestClusterKMeansVector(), kaldi::nnet3::TestNnetComponentUpdatable(), kaldi::TestVectorToPosteriorEntry(), SpMatrix< float >::TopEigs(), Plda::TransformIvector(), kaldi::UnitTestAddDiagMat2(), kaldi::UnitTestAddDiagMatMat(), kaldi::UnitTestAddDiagVecMat(), kaldi::nnet2::UnitTestAmNnet(), kaldi::UnitTestComplexFft(), kaldi::UnitTestComplexFt(), kaldi::UnitTestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMatLarge(), kaldi::UnitTestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMatLarge(), kaldi::UnitTestCuVectorAddVec(), UnitTestEstimateDiagGmm(), UnitTestEstimateFullGmm(), UnitTestEstimateLda(), kaldi::UnitTestEstimateMmieDiagGmm(), kaldi::UnitTestIo(), kaldi::UnitTestIoCross(), kaldi::UnitTestLbfgs(), kaldi::nnet2::UnitTestNnetDecodable(), kaldi::UnitTestNorm(), kaldi::UnitTestPldaEstimation(), kaldi::nnet3::UnitTestPreconditionDirectionsOnline(), kaldi::nnet2::UnitTestPreconditionDirectionsOnline(), kaldi::UnitTestRealFft(), kaldi::UnitTestSimpleForVec(), kaldi::UnitTestSplitRadixComplexFft(), kaldi::UnitTestSplitRadixRealFft(), kaldi::UnitTestVector(), kaldi::nnet3::UpdateNnetWithMaxChange(), IvectorExtractorStats::UpdatePrior(), EbwAmSgmm2Updater::UpdateSubstateWeights(), EbwAmSgmm2Updater::UpdateU(), MleAmSgmm2Updater::UpdateU(), MleAmSgmm2Updater::UpdateW(), MleSgmm2SpeakerAccs::UpdateWithU(), VectorClusterable::VectorClusterable(), LstmNonlinearityComponent::Write(), and NonlinearComponent::Write().
void Set | ( | Real | f | ) |
Set all members of a vector to a specified value.
Definition at line 336 of file kaldi-vector.cc.
Referenced by VectorBase< float >::AddColSumMat(), VectorBase< float >::AddRowSumMat(), MatrixBase< float >::AddVecToCols(), MatrixBase< float >::AddVecToRows(), kaldi::nnet2::CombineNnetsA(), kaldi::nnet3::ComputeAccuracy(), kaldi::ComputeLocalCost(), kaldi::nnet2::GetInitialModel(), FastNnetCombiner::GetInitialModel(), FastNnetCombiner::GetInitialParams(), kaldi::nnet2::GetInitialScaleParams(), LogisticRegression::GetLogPosteriors(), kaldi::nnet2::GetUpdateDirection(), OnlinePreconditionerSimple::InitDefault(), OnlineNaturalGradientSimple::InitDefault(), main(), kaldi::ReadData(), kaldi::SlidingWindowCmnInternal(), Plda::SmoothWithinClassCovariance(), kaldi::TestRecyclingVector(), TestSgmm2FmllrAccsIO(), TestSgmm2FmllrSubspace(), TestSgmm2PreXform(), kaldi::TrainOneIter(), kaldi::UnitTestAddVecToCols(), kaldi::UnitTestAddVecToRows(), UnitTestRegressionTree(), kaldi::UnitTestSimpleForVec(), and kaldi::nnet3::time_height_convolution::ZeroBlankRows().
void SetRandn | ( | ) |
Set vector to random normally-distributed noise.
Definition at line 301 of file kaldi-vector.cc.
Referenced by kaldi::CuVectorUnitTestAddVecVec(), ConstantComponent::InitFromConfig(), ConstantFunctionComponent::InitFromConfig(), main(), LogisticRegression::MixUp(), SoftmaxComponent::MixUp(), PitchInterpolator::MultiplyObsProb(), FullGmm::Perturb(), FullGmmNormal::Rand(), FullGmm::Split(), kaldi::TestClusterKMeansVector(), kaldi::TestClusterUtilsVector(), kaldi::nnet3::TestNnetDecodable(), kaldi::TestVectorToPosteriorEntry(), SpMatrix< float >::TopEigs(), kaldi::UnitTestAddDiagMat2(), kaldi::UnitTestAddDiagMatMat(), kaldi::UnitTestAddDiagVecMat(), kaldi::UnitTestAddMatDiagVec(), kaldi::UnitTestAddOuterProductPlusMinus(), kaldi::UnitTestAddVec2Sp(), kaldi::UnitTestAddVecCross(), kaldi::UnitTestAddVecToCols(), kaldi::UnitTestAddVecToColsSpeed(), kaldi::UnitTestAddVecToRows(), kaldi::UnitTestAddVecToRowsSpeed(), kaldi::UnitTestAddVecVec(), kaldi::nnet2::UnitTestAmNnet(), kaldi::UnitTestBackpropLstmNonlinearity(), kaldi::UnitTestCopyRowsAndCols(), kaldi::UnitTestCuMatrixAddVecVec(), kaldi::UnitTestCuSpMatrixAddVec2(), kaldi::UnitTestCuVectorAddTp(), kaldi::UnitTestCuVectorCopyFromVec(), kaldi::UnitTestCuVectorMulTp(), kaldi::UnitTestCuVectorReplaceValue(), kaldi::UnitTestDotprod(), kaldi::UnitTestFFTbasedBlockConvolution(), kaldi::UnitTestFFTbasedConvolution(), kaldi::UnitTestFloorCeiling(), kaldi::UnitTestFloorChol(), kaldi::UnitTestInnerProd(), kaldi::UnitTestIo(), kaldi::UnitTestIoCross(), kaldi::UnitTestLbfgs(), kaldi::UnitTestLinearCgd(), UnitTestLinearResample(), UnitTestLinearResample2(), kaldi::UnitTestMaxMin(), kaldi::UnitTestMul(), kaldi::UnitTestMulTp(), kaldi::nnet2::UnitTestNnetDecodable(), kaldi::UnitTestNorm(), kaldi::UnitTestPldaEstimation(), kaldi::nnet2::UnitTestPreconditionDirectionsOnline(), kaldi::nnet3::UnitTestPreconditionDirectionsOnline(), kaldi::UnitTestRange(), kaldi::UnitTestRemoveRow(), kaldi::UnitTestReplaceValue(), kaldi::UnitTestResize(), kaldi::UnitTestScale(), kaldi::UnitTestSger(), kaldi::UnitTestSimpleForMat(), kaldi::UnitTestSolve(), kaldi::UnitTestSpAddDiagVec(), kaldi::UnitTestSpAddVecVec(), kaldi::UnitTestSparseVectorAddToVec(), kaldi::UnitTestSparseVectorMax(), kaldi::UnitTestSparseVectorSum(), kaldi::UnitTestSparseVectorVecSvec(), kaldi::UnitTestSubvector(), kaldi::nnet3::UnitTestSummarizeVector(), kaldi::UnitTestTriVecSolver(), kaldi::UnitTestVecmul(), kaldi::UnitTestVector(), kaldi::UnitTestVectorMax(), and kaldi::UnitTestVectorMin().
void SetRandUniform | ( | ) |
Sets to numbers uniformly distributed on (0,1)
Definition at line 311 of file kaldi-vector.cc.
void SetZero | ( | ) |
Set vector to all zeros.
Definition at line 288 of file kaldi-vector.cc.
Referenced by MinimumBayesRisk::AccStats(), OnlineIvectorEstimationStats::AccStats(), MleSgmm2SpeakerAccs::Clear(), MleAmSgmm2Accs::CommitStatsForSpk(), MfccComputer::Compute(), OptimizeLbfgs< Real >::ComputeNewDirection(), kaldi::ConvolveSignals(), SparseVector< Real >::CopyElementsToVec(), kaldi::DiagGmmToStats(), kaldi::EBWUpdateGaussian(), OnlinePitchFeatureImpl::ExtractFrame(), kaldi::FFTbasedBlockConvolveSignals(), FullGmm::GetComponentMean(), OnlineIvectorEstimationStats::GetIvector(), FmllrRawAccs::InitSingleFrameStats(), main(), FullGmm::Merge(), FullGmm::MergePreselect(), DeltaFeatures::Process(), ShiftedDeltaFeatures::Process(), AccumFullGmm::Read(), LdaEstimate::Read(), AccumFullGmm::SetZero(), AccumDiagGmm::SetZero(), CuMatrixBase< float >::SetZeroAboveDiag(), kaldi::TestOnlineCmnInput(), kaldi::UnitTestCuVectorAddColSumMat(), kaldi::UnitTestCuVectorAddColSumMatLarge(), kaldi::UnitTestCuVectorAddRowSumMat(), kaldi::UnitTestCuVectorAddRowSumMatLarge(), LdaEstimate::ZeroAccumulators(), and RestrictedAttentionComponent::ZeroStats().
void Sigmoid | ( | const VectorBase< Real > & | src | ) |
Sets each element of *this to the sigmoid function of the corresponding element of "src".
Definition at line 938 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyCeiling(), and MatrixBase< float >::Sigmoid().
|
inline |
void Solve | ( | const TpMatrix< Real > & | M, |
const MatrixTransposeType | trans | ||
) |
If trans == kNoTrans, solves M x = b, where b is the value of *this at input and x is the value of *this at output.
If trans == kTrans, solves M' x = b. Does not test for M being singular or near-singular, so test it before calling this routine.
Definition at line 159 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyPow(), and kaldi::UnitTestTriVecSolver().
Real Sum | ( | ) | const |
Returns sum of the elements.
Definition at line 688 of file kaldi-vector.cc.
Referenced by OnlinePitchFeatureImpl::AcceptWaveform(), AccumAmDiagGmm::AccumulateFromPosteriors(), FmllrDiagGmmAccs::AccumulateFromPosteriors(), FmllrDiagGmmAccs::AccumulateFromPosteriorsPreselect(), Nnet::Check(), kaldi::ClusterGaussiansToUbm(), IvectorExtractorStats::CommitStatsForWPoint(), kaldi::nnet3::ComputeAccuracy(), kaldi::ComputeCorrelation(), AmSgmm2::ComputeFmllrPreXform(), EbwAmSgmm2Updater::ComputePhoneVecStats(), kaldi::ComputeVadEnergy(), OnlinePreconditioner::ComputeWt1(), OnlineNaturalGradient::ComputeWt1(), VectorBase< float >::CopyDiagFromTp(), kaldi::CuVectorUnitTestCopyDiagFromMat(), kaldi::CuVectorUnitTestSum(), kaldi::EstPca(), Xent::Eval(), Mse::Eval(), kaldi::GenRandStats(), IvectorExtractor::GetAcousticAuxf(), IvectorExtractor::GetAcousticAuxfVariance(), IvectorExtractor::GetAuxf(), IvectorExtractor::GetIvectorDistWeight(), LdaEstimate::GetStats(), kaldi::unittest::InitRandDiagGmm(), kaldi::InitRandomGmm(), IvectorExtractorStats::IvectorVarianceDiagnostic(), kaldi::nnet3::KlDivergence(), kaldi::nnet2::KlDivergence(), AffineComponent::LimitRank(), main(), TransitionModel::MapUpdate(), TransitionModel::MapUpdateShared(), kaldi::MleFullGmmUpdate(), TransitionModel::MleUpdate(), TransitionModel::MleUpdateShared(), kaldi::nnet1::MomentStatistics(), LimitRankClass::operator()(), PdfPrior::PdfPrior(), BackpropTruncationComponent::PrecomputeIndexes(), OnlinePreconditionerSimple::PreconditionDirectionsCpu(), OnlineNaturalGradientSimple::PreconditionDirectionsCpu(), OnlinePreconditioner::PreconditionDirectionsInternal(), OnlineNaturalGradient::PreconditionDirectionsInternal(), IvectorExtractorStats::PriorDiagnostics(), kaldi::ProcessWindow(), MleAmSgmm2Updater::RenormalizeN(), MleAmSgmm2Updater::RenormalizeV(), OnlineNaturalGradient::ReorthogonalizeRt1(), OnlinePreconditioner::ReorthogonalizeXt1(), Xent::Report(), CuVectorBase< float >::Sum(), kaldi::nnet3::SummarizeVector(), kaldi::TestCuVectorCopyFromVec(), kaldi::TraceMatMat(), kaldi::nnet2::UnitTestAmNnet(), kaldi::UnitTestDiagGmm(), kaldi::UnitTestEigSymmetric(), UnitTestFullGmm(), kaldi::nnet2::UnitTestNnetDecodable(), kaldi::UnitTestPosteriors(), kaldi::UnitTestRandCategorical(), kaldi::UnitTestRange(), kaldi::UnitTestResize(), kaldi::UnitTestSimpleForVec(), kaldi::UnitTestSparseVectorSum(), MleSgmm2SpeakerAccs::Update(), IvectorExtractorStats::Update(), kaldi::UpdateEbwWeightsDiagGmm(), EbwAmSgmm2Updater::UpdateM(), EbwAmSgmm2Updater::UpdateN(), MleSgmm2SpeakerAccs::UpdateNoU(), IvectorExtractorStats::UpdateProjections(), OnlinePitchFeatureImpl::UpdateRemainder(), EbwAmSgmm2Updater::UpdateSubstateWeights(), MleAmSgmm2Updater::UpdateSubstateWeights(), EbwAmSgmm2Updater::UpdateU(), MleAmSgmm2Updater::UpdateU(), IvectorExtractorStats::UpdateVariances(), MleAmSgmm2Updater::UpdateVars(), EbwAmSgmm2Updater::UpdateW(), MleAmSgmm2Updater::UpdateW(), IvectorExtractorStats::UpdateWeights(), MleSgmm2SpeakerAccs::UpdateWithU(), and MleAmSgmm2Accs::~MleAmSgmm2Accs().
Real SumLog | ( | ) | const |
Returns sum of the logs of the elements.
More efficient than just taking log of each. Will return NaN if any elements are negative.
Definition at line 697 of file kaldi-vector.cc.
Referenced by VectorBase< float >::CopyDiagFromTp(), Plda::LogLikelihoodRatio(), main(), and GaussClusterable::Objf().
void Tanh | ( | const VectorBase< Real > & | src | ) |
Sets each element of *this to the tanh of the corresponding element of "src".
Definition at line 900 of file kaldi-vector.cc.
Referenced by VectorBase< float >::ApplyCeiling(), and MatrixBase< float >::Tanh().
void Write | ( | std::ostream & | Out, |
bool | binary | ||
) | const |
Writes to C++ stream (option to write in binary).
Definition at line 1231 of file kaldi-vector.cc.
Referenced by LstmNonlinearityComponent::ConsolidateMemory(), VectorBase< float >::CopyDiagFromTp(), main(), kaldi::UnitTestIo(), kaldi::UnitTestIoCross(), UnitTestRegressionTree(), AccumFullGmm::Write(), LdaEstimate::Write(), Plda::Write(), RestrictedAttentionComponent::Write(), CuVector< float >::Write(), LstmNonlinearityComponent::Write(), IvectorExtractorStats::Write(), NonlinearComponent::Write(), and kaldi::nnet3::WriteVectorAsChar().
|
friend |
Definition at line 371 of file kaldi-vector.h.
|
friend |
Definition at line 370 of file kaldi-vector.h.
|
friend |
Definition at line 368 of file kaldi-vector.h.
|
friend |
Definition at line 369 of file kaldi-vector.h.
|
protected |
data memory area
Definition at line 395 of file kaldi-vector.h.
Referenced by VectorBase< float >::AddVec(), VectorBase< float >::AddVec2(), VectorBase< float >::AddVecDivVec(), VectorBase< float >::AddVecVec(), VectorBase< float >::ApplyLogSoftMax(), VectorBase< float >::ApproxEqual(), VectorBase< float >::Ceiling(), VectorBase< float >::CopyFromVec(), VectorBase< float >::CopyRowFromSp(), VectorBase< float >::Data(), VectorBase< float >::DivElements(), VectorBase< float >::Floor(), VectorBase< float >::MulElements(), VectorBase< float >::operator()(), VectorBase< float >::Pow(), Vector< float >::Resize(), VectorBase< float >::Sigmoid(), SubVector< Real >::SubVector(), CuVector< float >::Swap(), Vector< float >::Swap(), and VectorBase< float >::Tanh().
|
protected |
dimension of vector
Definition at line 397 of file kaldi-vector.h.
Referenced by VectorBase< float >::AddMatSvec(), VectorBase< float >::AddMatVec(), VectorBase< float >::AddSpVec(), VectorBase< float >::AddTpVec(), VectorBase< float >::AddVec(), VectorBase< float >::AddVec2(), VectorBase< float >::AddVecDivVec(), VectorBase< float >::AddVecVec(), VectorBase< float >::ApplyLogSoftMax(), VectorBase< float >::ApproxEqual(), VectorBase< float >::Ceiling(), CuVector< float >::CuVector(), VectorBase< float >::Dim(), VectorBase< float >::DivElements(), VectorBase< float >::Floor(), VectorBase< float >::MulElements(), VectorBase< float >::operator()(), VectorBase< float >::Pow(), VectorBase< float >::Sigmoid(), VectorBase< float >::SizeInBytes(), SubVector< Real >::SubVector(), CuVector< float >::Swap(), Vector< float >::Swap(), and VectorBase< float >::Tanh().