transform-common.h
Go to the documentation of this file.
1 // transform/transform-common.h
2 
3 // Copyright 2009-2011 Saarland University; Georg Stemmer
4 
5 // See ../../COPYING for clarification regarding multiple authors
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16 // MERCHANTABLITY OR NON-INFRINGEMENT.
17 // See the Apache 2 License for the specific language governing permissions and
18 // limitations under the License.
19 
20 #ifndef KALDI_TRANSFORM_TRANSFORM_COMMON_H_
21 #define KALDI_TRANSFORM_TRANSFORM_COMMON_H_
22 
23 #include <vector>
24 
25 #include "matrix/matrix-lib.h"
26 
27 namespace kaldi {
28 
29 
31  public:
33  double beta_;
41  std::vector< SpMatrix<double> > G_;
44  AffineXformStats(): beta_(0.0), dim_(0.0) {}
45  void Init(int32 dim, int32 num_gs); // num_gs will equal dim for diagonal FMLLR.
46  int32 Dim() const { return dim_; }
47  void SetZero();
48  void CopyStats(const AffineXformStats &other);
49  void Add(const AffineXformStats &other);
50  void Write(std::ostream &out, bool binary) const;
51  void Read(std::istream &in, bool binary, bool add);
52  AffineXformStats(const AffineXformStats &other): beta_(other.beta_),
53  K_(other.K_),
54  G_(other.G_),
55  dim_(other.dim_) {}
56  // Note: allowing copy and assignment with their default
57  // values. All class members are OK with this.
58 };
59 
61  bool b_is_affine,
63 
68 
69 
70 
71 } // namespace kaldi
72 
73 #endif // KALDI_TRANSFORM_TRANSFORM_COMMON_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
Matrix< double > K_
K_ is the summed outer product of [mean times inverse variance] with [extended data], scaled by the occupation counts; dimension is dim by (dim+1)
Base class which provides matrix operations not involving resizing or allocation. ...
Definition: kaldi-matrix.h:49
AffineXformStats(const AffineXformStats &other)
kaldi::int32 int32
int32 dim_
dim_ is the feature dimension.
void Write(std::ostream &out, bool binary) const
void Add(const AffineXformStats &other)
std::vector< SpMatrix< double > > G_
G_ is the outer product of extended-data, scaled by inverse variance, for each dimension.
void Read(std::istream &in, bool binary, bool add)
void Init(int32 dim, int32 num_gs)
bool ComposeTransforms(const Matrix< BaseFloat > &a, const Matrix< BaseFloat > &b, bool b_is_affine, Matrix< BaseFloat > *c)
void CopyStats(const AffineXformStats &other)
Provides a vector abstraction class.
Definition: kaldi-vector.h:41
void ApplyAffineTransform(const MatrixBase< BaseFloat > &xform, VectorBase< BaseFloat > *vec)
Applies the affine transform &#39;xform&#39; to the vector &#39;vec&#39; and overwrites the contents of &#39;vec&#39;...
double beta_
beta_ is the occupation count.