21 #ifndef KALDI_MATRIX_COMPRESSED_MATRIX_H_ 22 #define KALDI_MATRIX_COMPRESSED_MATRIX_H_ 1 97 template<
typename Real>
119 bool allow_padding =
false);
124 template<
typename Real>
132 template<
typename Real>
137 template<
typename Real>
141 void Write(std::ostream &os,
bool binary)
const;
143 void Read(std::istream &is,
bool binary);
155 template<
typename Real>
160 template<
typename Real>
166 template<
typename Real>
177 void Scale(
float alpha);
224 template<
typename Real>
241 template<
typename Real>
246 template<
typename Real>
262 static inline uint8
FloatToChar(
float p0,
float p25,
263 float p75,
float p100,
267 static inline float CharToFloat(
float p0,
float p25,
268 float p75,
float p100,
283 #endif // KALDI_MATRIX_COMPRESSED_MATRIX_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void CopyRowToVec(MatrixIndexT row, VectorBase< Real > *v) const
Copies row #row of the matrix into vector v.
void CopyColToVec(MatrixIndexT col, VectorBase< Real > *v) const
Copies column #col of the matrix into vector v.
CompressedMatrix(const MatrixBase< Real > &mat, CompressionMethod method=kAutomaticMethod)
void Swap(CompressedMatrix *other)
Base class which provides matrix operations not involving resizing or allocation. ...
void swap(basic_filebuf< CharT, Traits > &x, basic_filebuf< CharT, Traits > &y)
A class for storing matrices.
CompressedMatrix & operator=(const CompressedMatrix &mat)
void Write(std::ostream &os, bool binary) const
void Read(std::istream &is, bool binary)
static uint16 FloatToUint16(const GlobalHeader &global_header, float value)
void Scale(float alpha)
scales all elements of matrix by alpha.
static float Uint16ToFloat(const GlobalHeader &global_header, uint16 value)
static void ComputeGlobalHeader(const MatrixBase< Real > &mat, CompressionMethod method, GlobalHeader *header)
static uint8 FloatToUint8(const GlobalHeader &global_header, float value)
MatrixIndexT NumRows() const
Returns number of rows (or zero for emtpy matrix).
static void CompressColumn(const GlobalHeader &global_header, const Real *data, MatrixIndexT stride, int32 num_rows, PerColHeader *header, uint8 *byte_data)
static float CharToFloat(float p0, float p25, float p75, float p100, uint8 value)
static uint8 FloatToChar(float p0, float p25, float p75, float p100, float value)
static void * AllocateData(int32 num_bytes)
Provides a vector abstraction class.
static void ComputeColHeader(const GlobalHeader &global_header, const Real *data, MatrixIndexT stride, int32 num_rows, PerColHeader *header)
MatrixIndexT NumCols() const
Returns number of columns (or zero for emtpy matrix).
void CopyToMat(MatrixBase< Real > *mat, MatrixTransposeType trans=kNoTrans) const
Copies contents to matrix.
void CopyFromMat(const MatrixBase< Real > &mat, CompressionMethod method=kAutomaticMethod)
This will resize *this and copy the contents of mat to *this.
static MatrixIndexT DataSize(const GlobalHeader &header)