matrix-common.h
Go to the documentation of this file.
1 // matrix/matrix-common.h
2 
3 // Copyright 2009-2011 Microsoft Corporation
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 #ifndef KALDI_MATRIX_MATRIX_COMMON_H_
20 #define KALDI_MATRIX_MATRIX_COMMON_H_
21 
22 // This file contains some #includes, forward declarations
23 // and typedefs that are needed by all the main header
24 // files in this directory.
25 
26 #include "base/kaldi-common.h"
27 
28 namespace kaldi {
29 // this enums equal to CblasTrans and CblasNoTrans constants from CBLAS library
30 // we are writing them as literals because we don't want to include here matrix/kaldi-blas.h,
31 // which puts many symbols into global scope (like "real") via the header f2c.h
32 typedef enum {
33  kTrans = 112, // = CblasTrans
34  kNoTrans = 111 // = CblasNoTrans
36 
37 typedef enum {
42 
43 
44 typedef enum {
48 
49 typedef enum {
54 } SpCopyType;
55 
56 template<typename Real> class VectorBase;
57 template<typename Real> class Vector;
58 template<typename Real> class SubVector;
59 template<typename Real> class MatrixBase;
60 template<typename Real> class SubMatrix;
61 template<typename Real> class Matrix;
62 template<typename Real> class SpMatrix;
63 template<typename Real> class TpMatrix;
64 template<typename Real> class PackedMatrix;
65 template<typename Real> class SparseMatrix;
66 
67 // these are classes that won't be defined in this
68 // directory; they're mostly needed for friend declarations.
69 template<typename Real> class CuMatrixBase;
70 template<typename Real> class CuSubMatrix;
71 template<typename Real> class CuMatrix;
72 template<typename Real> class CuVectorBase;
73 template<typename Real> class CuSubVector;
74 template<typename Real> class CuVector;
75 template<typename Real> class CuPackedMatrix;
76 template<typename Real> class CuSpMatrix;
77 template<typename Real> class CuTpMatrix;
78 template<typename Real> class CuSparseMatrix;
79 
80 class CompressedMatrix;
81 class GeneralMatrix;
82 
84 template<typename T> class OtherReal { }; // useful in reading+writing routines
85  // to switch double and float.
87 template<> class OtherReal<float> {
88  public:
89  typedef double Real;
90 };
92 template<> class OtherReal<double> {
93  public:
94  typedef float Real;
95 };
96 
97 
100 typedef uint32 UnsignedMatrixIndexT;
101 
102 // If you want to use size_t for the index type, do as follows instead:
103 //typedef size_t MatrixIndexT;
104 //typedef ssize_t SignedMatrixIndexT;
105 //typedef size_t UnsignedMatrixIndexT;
106 
107 }
108 
109 
110 
111 #endif // KALDI_MATRIX_MATRIX_COMMON_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
This class provides a way for switching between double and float types.
Definition: matrix-common.h:84
Packed symetric matrix class.
Definition: matrix-common.h:62
This class is a wrapper that enables you to store a matrix in one of three forms: either as a Matrix<...
MatrixResizeType
Definition: matrix-common.h:37
Base class which provides matrix operations not involving resizing or allocation. ...
Definition: kaldi-matrix.h:49
kaldi::int32 int32
A class for storing matrices.
Definition: kaldi-matrix.h:823
This class represents a matrix that&#39;s stored on the GPU if we have one, and in memory if not...
Definition: matrix-common.h:71
uint32 UnsignedMatrixIndexT
int32 MatrixIndexT
Definition: matrix-common.h:98
Packed matrix: base class for triangular and symmetric matrices.
Definition: matrix-common.h:64
MatrixStrideType
Definition: matrix-common.h:44
Packed symetric matrix class.
Definition: matrix-common.h:63
This class is used for a piece of a CuMatrix.
Definition: matrix-common.h:70
Matrix for CUDA computing.
Definition: matrix-common.h:69
A class representing a vector.
Definition: kaldi-vector.h:406
int32 SignedMatrixIndexT
Definition: matrix-common.h:99
Matrix for CUDA computing.
Definition: matrix-common.h:75
MatrixTransposeType
Definition: matrix-common.h:32
Provides a vector abstraction class.
Definition: kaldi-vector.h:41
Sub-matrix representation.
Definition: kaldi-matrix.h:988
Represents a non-allocating general vector which can be defined as a sub-vector of higher-level vecto...
Definition: kaldi-vector.h:501
Vector for CUDA computing.
Definition: matrix-common.h:72