27 Matrix<BaseFloat> *mat) {
29 if (new_dimension < d)
30 KALDI_ERR <<
"--new-dimension argument invalid or not specified: " 31 << new_dimension <<
" < " <<
d;
32 if (mat->NumCols() ==
d) {
33 mat->Resize(new_dimension, new_dimension,
kCopyData);
34 for (
int32 i = d;
i < new_dimension;
i++)
36 }
else if (mat->NumCols() == d+1) {
37 Vector<BaseFloat> offset(mat->NumRows());
38 offset.CopyColFromMat(*mat, d);
40 mat->Resize(new_dimension, new_dimension+1,
kCopyData);
41 for (
int32 i = d;
i < new_dimension;
i++)
44 (*mat)(
d,
i) = offset(
i);
46 KALDI_ERR <<
"Input matrix has unexpected dimension " << d
47 <<
" x " << mat->NumCols();
54 int main(
int argc,
char *argv[]) {
56 using namespace kaldi;
59 "This is a special-purpose program to be used in \"predictive SGMMs\".\n" 60 "It takes in an LDA+MLLT matrix, and the original \"full\" LDA matrix\n" 61 "as output by the --write-full-matrix option of est-lda; and it writes\n" 62 "out a \"full\" LDA+MLLT matrix formed by the LDA+MLLT matrix plus the\n" 63 "remaining rows of the \"full\" LDA matrix; and also writes out its inverse\n" 64 "Usage: get-full-lda-mat [options] <lda-mllt-rxfilename> <full-lda-rxfilename> " 65 "<full-lda-mllt-wxfilename> [<inv-full-lda-mllt-wxfilename>]\n" 66 "E.g.: get-full-lda-mat final.mat full.mat full_lda_mllt.mat full_lda_mllt_inv.mat\n";
71 po.
Register(
"binary", &binary,
"Write in binary mode (only relevant if output is a wxfilename)");
80 std::string lda_mllt_rxfilename = po.
GetArg(1),
81 full_lda_rxfilename = po.
GetArg(2),
82 full_lda_mllt_wxfilename = po.
GetArg(3),
83 inv_full_lda_mllt_wxfilename = po.
GetOptArg(4);
85 Matrix<BaseFloat> lda_mllt;
87 Matrix<BaseFloat> full_lda;
93 Matrix<BaseFloat> full_lda_mllt(full_lda);
94 full_lda_mllt.Range(0, lda_mllt.NumRows(),
95 0, lda_mllt.NumCols()).CopyFromMat(lda_mllt);
100 full_lda_mllt.Invert();
104 }
catch(
const std::exception &e) {
105 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
void Register(const std::string &name, bool *ptr, const std::string &doc)
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
#define KALDI_ASSERT(cond)
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
void IncreaseTransformDimension(int32 new_dimension, Matrix< BaseFloat > *mat)
int main(int argc, char *argv[])
std::string GetOptArg(int param) const