28 while (between_proj.
Cond() > 100)
31 while (within_proj.
Cond() > 100)
37 global_mean.
Scale(10.0);
41 for (
int32 n = 0;
n < num_classes;
n++) {
55 double weight = 1.0 + (0.1 * (
Rand() % 30));
63 between_var.AddMat2(1.0, between_proj,
kNoTrans, 0.0);
73 KALDI_LOG <<
"Trace of true between-var is " << between_var.Trace();
82 between_var_proj.
Eig(&s);
86 KALDI_LOG <<
"Diagonal of between-class variance in normalized space " 87 <<
"should be: " << s;
106 using namespace kaldi;
108 for (
int i = 0;
i < 5;
i++)
113 std::cout <<
"Test OK.\n";
void AddMat2(const Real alpha, const MatrixBase< Real > &M, MatrixTransposeType transM, const Real beta)
rank-N update: if (transM == kNoTrans) (*this) = beta*(*this) + alpha * M * M^T, or (if transM == kTr...
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Estimate(const PldaEstimationConfig &config, Plda *output)
Real Cond() const
Returns condition number by computing Svd.
void Eig(VectorBase< Real > *s, MatrixBase< Real > *P=NULL) const
Solves the symmetric eigenvalue problem: at end we should have (*this) = P * diag(s) * P^T...
void AddTp2Sp(const Real alpha, const TpMatrix< Real > &T, MatrixTransposeType transM, const SpMatrix< Real > &A, const Real beta=0.0)
The following function does: this <– beta*this + alpha * T * A * T^T.
void SetVerboseLevel(int32 i)
This should be rarely used, except by programs using Kaldi as library; command-line programs set the ...
void Cholesky(const SpMatrix< Real > &orig)
void UnitTestPldaEstimation(int32 dim)
void AddVecToRows(const Real alpha, const VectorBase< OtherReal > &v)
[each row of *this] += alpha * v
void SetRandn()
Sets to random values of a normal distribution.
void AddMatMat(const Real alpha, const MatrixBase< Real > &A, MatrixTransposeType transA, const MatrixBase< Real > &B, MatrixTransposeType transB, const Real beta)
Real * Data()
Returns a pointer to the start of the vector's data.
MatrixIndexT Dim() const
Returns the dimension of the vector.
void Scale(Real alpha)
Multiplies all elements by this constant.
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.
int Rand(struct RandomState *state)
void SetRandn()
Set vector to random normally-distributed noise.
void AddSamples(double weight, const Matrix< double > &group)
The dimension is set up the first time you add samples.