// matrix/matrix-common.h // Copyright 2009-2011 Microsoft Corporation // See ../../COPYING for clarification regarding multiple authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, // MERCHANTABLITY OR NON-INFRINGEMENT. // See the Apache 2 License for the specific language governing permissions and // limitations under the License. #ifndef KALDI_MATRIX_MATRIX_COMMON_H_ #define KALDI_MATRIX_MATRIX_COMMON_H_ // This file contains some #includes, forward declarations // and typedefs that are needed by all the main header // files in this directory. #include "base/kaldi-common.h" namespace kaldi { // this enums equal to CblasTrans and CblasNoTrans constants from CBLAS library // we are writing them as literals because we don't want to include here matrix/kaldi-blas.h, // which puts many symbols into global scope (like "real") via the header f2c.h typedef enum { kTrans = 112, // = CblasTrans kNoTrans = 111 // = CblasNoTrans } MatrixTransposeType; typedef enum { kSetZero, kUndefined, kCopyData } MatrixResizeType; typedef enum { kDefaultStride, kStrideEqualNumCols, } MatrixStrideType; typedef enum { kTakeLower, kTakeUpper, kTakeMean, kTakeMeanAndCheck } SpCopyType; template class VectorBase; template class Vector; template class SubVector; template class MatrixBase; template class SubMatrix; template class Matrix; template class SpMatrix; template class TpMatrix; template class PackedMatrix; template class SparseMatrix; // these are classes that won't be defined in this // directory; they're mostly needed for friend declarations. template class CuMatrixBase; template class CuSubMatrix; template class CuMatrix; template class CuVectorBase; template class CuSubVector; template class CuVector; template class CuPackedMatrix; template class CuSpMatrix; template class CuTpMatrix; template class CuSparseMatrix; class CompressedMatrix; class GeneralMatrix; /// This class provides a way for switching between double and float types. template class OtherReal { }; // useful in reading+writing routines // to switch double and float. /// A specialized class for switching from float to double. template<> class OtherReal { public: typedef double Real; }; /// A specialized class for switching from double to float. template<> class OtherReal { public: typedef float Real; }; typedef int32 MatrixIndexT; typedef int32 SignedMatrixIndexT; typedef uint32 UnsignedMatrixIndexT; // If you want to use size_t for the index type, do as follows instead: //typedef size_t MatrixIndexT; //typedef ssize_t SignedMatrixIndexT; //typedef size_t UnsignedMatrixIndexT; } #endif // KALDI_MATRIX_MATRIX_COMMON_H_