25 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
30 "Sum the rows of an input table of matrices and output the corresponding\n" 33 "Usage: matrix-sum-rows [options] <matrix-rspecifier> <vector-wspecifier>\n" 34 "e.g.: matrix-sum-rows ark:- ark:- | vector-sum ark:- sum.vec\n" 35 "See also: matrix-sum, vector-sum\n";
46 std::string rspecifier = po.
GetArg(1);
47 std::string wspecifier = po.
GetArg(2);
53 int64 num_rows_done = 0;
55 for (; !mat_reader.
Done(); mat_reader.
Next()) {
56 std::string key = mat_reader.
Key();
62 vec_writer.
Write(key, float_vec);
64 num_rows_done += mat.NumRows();
67 KALDI_LOG <<
"Summed rows " << num_done <<
" matrices, " 68 << num_rows_done <<
" rows in total.";
70 return (num_done != 0 ? 0 : 1);
71 }
catch(
const std::exception &e) {
72 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void AddRowSumMat(Real alpha, const MatrixBase< Real > &M, Real beta=1.0)
Does *this = alpha * (sum of rows of M) + beta * *this.
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
A templated class for writing objects to an archive or script file; see The Table concept...
void Write(const std::string &key, const T &value) const
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
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).
int main(int argc, char *argv[])