28     using namespace kaldi;
    31         "Scale vectors, or archives of vectors (useful for speaker vectors and "    32         "per-frame weights)\n"    33         "Usage: vector-scale [options] <vector-in-rspecifier> <vector-out-wspecifier>\n"    34         "   or: vector-scale [options] <vector-in-rxfilename> <vector-out-wxfilename>\n"    35         " e.g.: vector-scale --scale=-1.0 1.vec -\n"    36         "       vector-scale --scale=-2.0 ark:vec.ark ark,t:-\n"    37         "See also: copy-vector, vector-sum\n";
    43     po.Register(
"binary", &binary, 
"If true, write output as binary "    44                 "not relevant for archives");
    45     po.Register(
"scale", &scale, 
"Scaling factor for vectors");
    48     if (po.NumArgs() != 2) {
    53     std::string vector_in_fn = po.GetArg(1);
    54     std::string vector_out_fn = po.GetArg(2);
    58         KALDI_ERR << 
"Cannot mix archives and regular files";
    62       for (; !vec_reader.Done(); vec_reader.Next()) {
    65         vec_writer.Write(vec_reader.Key(), vec);
    69         KALDI_ERR << 
"Cannot mix archives and regular files";
    72       Input ki(vector_in_fn, &binary_in);
    74       vec.
Read(ki.Stream(), binary_in);
    76       Output ko(vector_out_fn, binary);
    77       vec.
Write(ko.Stream(), binary);
    81   } 
catch(
const std::exception &e) {
    82     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void Write(std::ostream &Out, bool binary) const
Writes to C++ stream (option to write in binary). 
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
 
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...
 
void Scale(Real alpha)
Multiplies all elements by this constant. 
 
WspecifierType ClassifyWspecifier(const std::string &wspecifier, std::string *archive_wxfilename, std::string *script_wxfilename, WspecifierOptions *opts)
 
A class representing a vector. 
 
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.