28     using namespace kaldi;
    31         "This program applies a linear or affine transform to individual vectors, e.g.\n"    32         "iVectors.  It is transform-feats, except it works on vectors rather than matrices,\n"    33         "and expects a single transform matrix rather than possibly a table of matrices\n"    35         "Usage: transform-vec [options] <transform-rxfilename> <feats-rspecifier> <feats-wspecifier>\n"    36         "See also: transform-feats, est-pca\n";
    42     if (po.NumArgs() != 3) {
    47     std::string transform_rxfilename = po.GetArg(1);
    48     std::string vec_rspecifier = po.GetArg(2);
    49     std::string vec_wspecifier = po.GetArg(3);
    59     for (; !vec_reader.Done(); vec_reader.Next()) {
    60       std::string key = vec_reader.Key();
    64           transform_cols = transform.
NumCols(),
    69       if (transform_cols == vec_dim) {
    70         vec_out.AddMatVec(1.0, transform, 
kNoTrans, vec, 0.0);
    72         if (transform_cols != vec_dim + 1) {
    73           KALDI_ERR << 
"Dimension mismatch: input vector has dimension "    74                     << vec.Dim() << 
" and transform has " << transform_cols
    77         vec_out.CopyColFromMat(transform, vec_dim);
    78         vec_out.AddMatVec(1.0, transform.
Range(0, transform.
NumRows(),
    81       vec_writer.Write(key, vec_out);
    85     KALDI_LOG << 
"Applied transform to " << num_done << 
" vectors.";
    87     return (num_done != 0 ? 0 : 1);
    88   } 
catch(
const std::exception &e) {
    89     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix). 
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
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...
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
A class representing a vector. 
 
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix). 
 
SubMatrix< Real > Range(const MatrixIndexT row_offset, const MatrixIndexT num_rows, const MatrixIndexT col_offset, const MatrixIndexT num_cols) const
Return a sub-part of matrix.