33 KALDI_WARN <<
"Trying to precondition set of only one frames: returning " 34 <<
"unchanged. Ignore this warning if infrequent.";
81 #if 0 // Old code before it was optimized for CUDA: 85 beta = 1 + gamma / (N - 1 - gamma);
86 if (!(gamma >= 0.0 && beta > 0.0)) {
87 KALDI_ERR <<
"Bad values encountered in preconditioning: gamma = " << gamma
88 <<
", beta = " << beta;
102 this_beta = 1.0 + this_gamma / (N - 1 - this_gamma);
103 if (!(this_gamma >= 0.0 && this_beta > 0.0))
104 KALDI_ERR <<
"Bad values encountered in preconditioning: gamma = " 105 << this_gamma <<
", beta = " << this_beta;
106 cpu_beta(
n) = this_beta;
131 KALDI_WARN <<
"Zero or negative lambda in PreconditionDirectionsAlpha.";
159 rescale = sqrt(t / p_trace);
void CopyFromMat(const MatrixBase< OtherReal > &src, MatrixTransposeType trans=kNoTrans)
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Packed symetric matrix class.
int32 GetVerboseLevel()
Get verbosity level, usually set via command line '–verbose=' switch.
void PreconditionDirectionsAlpha(const CuMatrixBase< BaseFloat > &R, double alpha, CuMatrixBase< BaseFloat > *P)
This wrapper for PreconditionDirections computes lambda using = /(N D) trace(R^T, R), and calls PreconditionDirections.
void AddToDiag(Real value)
Adds "value" to the diagonal elements of the matrix.
void PreconditionDirections(const CuMatrixBase< BaseFloat > &R, double lambda, CuMatrixBase< BaseFloat > *P)
See below for comment.
This class represents a matrix that's stored on the GPU if we have one, and in memory if not...
void AddDiagMatMat(Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType transM, const CuMatrixBase< 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 kNoT...
void PrintEigs(const char *name)
bool SameDim(const MatrixBase< Real > &M, const MatrixBase< Real > &N)
void SymInvertPosDef()
Inversion for positive definite symmetric matrices.
void SymAddMat2(const Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType transA, Real beta)
*this = beta * *this + alpha * M M^T, for symmetric matrices.
void AddMatMat(Real alpha, const CuMatrixBase< Real > &A, MatrixTransposeType transA, const CuMatrixBase< Real > &B, MatrixTransposeType transB, Real beta)
C = alpha * A(^T)*B(^T) + beta * C.
Real TraceMatMat(const MatrixBase< Real > &A, const MatrixBase< Real > &B, MatrixTransposeType trans)
We need to declare this here as it will be a friend function.
int Rand(struct RandomState *state)
Matrix for CUDA computing.
MatrixIndexT NumCols() const
A class representing a vector.
#define KALDI_ASSERT(cond)
MatrixIndexT NumRows() const
Dimensions.
Real VecVec(const VectorBase< Real > &a, const VectorBase< Real > &b)
Returns dot product between v1 and v2.
void MulRowsVec(const CuVectorBase< Real > &scale)
scale i'th row by scale[i]
void PreconditionDirectionsAlphaRescaled(const CuMatrixBase< BaseFloat > &R, double alpha, CuMatrixBase< BaseFloat > *P)
This wrapper for PreconditionDirections computes lambda using = /(N D) trace(R^T, R), and calls PreconditionDirections.