kaldi-vector-inl.h
Go to the documentation of this file.
1 // matrix/kaldi-vector-inl.h
2 
3 // Copyright 2009-2011 Ondrej Glembek; Microsoft Corporation;
4 // Haihua Xu
5 
6 // See ../../COPYING for clarification regarding multiple authors
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 // MERCHANTABLITY OR NON-INFRINGEMENT.
18 // See the Apache 2 License for the specific language governing permissions and
19 // limitations under the License.
20 
21 // This is an internal header file, included by other library headers.
22 // You should not attempt to use it directly.
23 
24 #ifndef KALDI_MATRIX_KALDI_VECTOR_INL_H_
25 #define KALDI_MATRIX_KALDI_VECTOR_INL_H_ 1
26 
27 namespace kaldi {
28 
29 template<typename Real>
30 std::ostream & operator << (std::ostream &os, const VectorBase<Real> &rv) {
31  rv.Write(os, false);
32  return os;
33 }
34 
35 template<typename Real>
36 std::istream &operator >> (std::istream &is, VectorBase<Real> &rv) {
37  rv.Read(is, false);
38  return is;
39 }
40 
41 template<typename Real>
42 std::istream &operator >> (std::istream &is, Vector<Real> &rv) {
43  rv.Read(is, false);
44  return is;
45 }
46 
47 template<>
48 template<>
49 void VectorBase<float>::AddVec(const float alpha, const VectorBase<float> &rv);
50 
51 template<>
52 template<>
53 void VectorBase<double>::AddVec<double>(const double alpha,
54  const VectorBase<double> &rv);
55 
56 } // namespace kaldi
57 
58 #endif // KALDI_MATRIX_KALDI_VECTOR_INL_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
void Read(std::istream &in, bool binary, bool add=false)
Reads from C++ stream (option to add to existing contents).
std::istream & operator>>(std::istream &is, Matrix< Real > &M)
A class representing a vector.
Definition: kaldi-vector.h:406
Provides a vector abstraction class.
Definition: kaldi-vector.h:41
void AddVec(const Real alpha, const VectorBase< OtherReal > &v)
Add vector : *this = *this + alpha * rv (with casting between floats and doubles) ...
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.