cu-tp-matrix.h
Go to the documentation of this file.
1 // cudamatrix/cu-tp-matrix.h
2 
3 // Copyright 2013 Ehsan Variani
4 // 2015 Johns Hopkins University (author: Daniel Povey)
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 #ifndef KALDI_CUDAMATRIX_CU_TP_MATRIX_H_
22 #define KALDI_CUDAMATRIX_CU_TP_MATRIX_H_
23 
24 #include <sstream>
25 
26 #include "cudamatrix/cu-common.h"
27 #include "matrix/matrix-common.h"
28 #include "matrix/tp-matrix.h"
29 #include "cudamatrix/cu-array.h"
30 #include "cudamatrix/cu-math.h"
32 #include "cudamatrix/cu-matrix.h"
33 
34 namespace kaldi {
35 
36 template<typename Real> class CuTpMatrix;
37 
38 template<typename Real>
39 class CuTpMatrix : public CuPackedMatrix<Real> {
40  friend class CuMatrixBase<float>;
41  friend class CuMatrixBase<double>;
42  friend class CuVectorBase<Real>;
43  friend class CuSubMatrix<Real>;
44  friend class CuRand<Real>;
45  friend class CuTpMatrix<float>;
46  friend class CuTpMatrix<double>;
47  public:
48  CuTpMatrix() : CuPackedMatrix<Real>() {}
49  explicit CuTpMatrix(MatrixIndexT r, MatrixResizeType resize_type = kSetZero)
50  : CuPackedMatrix<Real>(r, resize_type) {}
51 
52  explicit CuTpMatrix<Real>(const TpMatrix<Real> &orig)
53  : CuPackedMatrix<Real>(orig) {}
54  // This constructor lacks the "explicit" keyword so that
55  // we can include this class in std::vector.
57  : CuPackedMatrix<Real>(orig) {}
58 
59  explicit CuTpMatrix<Real>(const CuMatrixBase<Real> &orig,
61 
62 
64 
65  void CopyFromMat(const CuMatrixBase<Real> &M,
67 
68  void CopyFromTp(const CuTpMatrix<Real> &other) {
70  }
71  void CopyFromTp(const TpMatrix<Real> &other) {
73  }
74  void Cholesky(const CuSpMatrix<Real>& Orig);
75  void Invert();
76 
78 
79  protected:
80  inline const TpMatrix<Real> &Mat() const {
81  return *(reinterpret_cast<const TpMatrix<Real>* >(this));
82  }
83  inline TpMatrix<Real> &Mat() {
84  return *(reinterpret_cast<TpMatrix<Real>* >(this));
85  }
86 };
87 
88 } // namespace
89 
90 #endif
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
MatrixResizeType
Definition: matrix-common.h:37
void CopyFromTp(const CuTpMatrix< Real > &other)
Definition: cu-tp-matrix.h:68
TpMatrix< Real > & Mat()
Definition: cu-tp-matrix.h:83
void Cholesky(const CuSpMatrix< Real > &Orig)
Definition: cu-tp-matrix.cc:48
int32 MatrixIndexT
Definition: matrix-common.h:98
CuTpMatrix(MatrixIndexT r, MatrixResizeType resize_type=kSetZero)
Definition: cu-tp-matrix.h:49
Packed symetric matrix class.
Definition: matrix-common.h:63
This class is used for a piece of a CuMatrix.
Definition: matrix-common.h:70
CuTpMatrix< Real > & operator=(const CuTpMatrix< Real > &in)
Matrix for CUDA computing.
Definition: matrix-common.h:69
void CopyFromTp(const TpMatrix< Real > &other)
Definition: cu-tp-matrix.h:71
Matrix for CUDA computing.
Definition: matrix-common.h:75
MatrixTransposeType
Definition: matrix-common.h:32
void CopyFromMat(const CuMatrixBase< Real > &M, MatrixTransposeType Trans=kNoTrans)
Definition: cu-tp-matrix.cc:89
const TpMatrix< Real > & Mat() const
Definition: cu-tp-matrix.h:80
void CopyFromPacked(const CuPackedMatrix< Real > &src)
Vector for CUDA computing.
Definition: matrix-common.h:72