21 #ifndef KALDI_CUDAMATRIX_CU_SP_MATRIX_H_ 22 #define KALDI_CUDAMATRIX_CU_SP_MATRIX_H_ 37 template<
typename Real,
typename OtherReal>
38 Real
TraceSpSp(
const CuSpMatrix<Real> &A,
const CuSpMatrix<OtherReal> &B);
40 template<
typename Real>
41 class CuSpMatrix :
public CuPackedMatrix<Real> {
48 template<
class R,
class S>
81 bool IsUnit(Real tol = 0.001)
const;
100 if (static_cast<UnsignedMatrixIndexT>(c) >
101 static_cast<UnsignedMatrixIndexT>(r))
104 static_cast<UnsignedMatrixIndexT>(this->
num_rows_));
109 if (static_cast<UnsignedMatrixIndexT>(c) >
110 static_cast<UnsignedMatrixIndexT>(r))
113 static_cast<UnsignedMatrixIndexT>(this->
num_rows_));
140 template<
typename Real>
143 return A.ApproxEqual(B, tol);
146 template<
typename Real>
153 template<
typename Real>
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Packed symetric matrix class.
CuSpMatrix< Real > & operator=(const CuSpMatrix< Real > &in)
void AddPacked(const Real alpha, const CuPackedMatrix< Real > &M)
MatrixIndexT NumRows() const
CuValue< Real > operator()(MatrixIndexT r, MatrixIndexT c)
void CopyToPacked(PackedMatrix< Real > *dst) const
CuSpMatrix(MatrixIndexT r, MatrixResizeType resize_type=kSetZero)
void swap(basic_filebuf< CharT, Traits > &x, basic_filebuf< CharT, Traits > &y)
void Invert()
Note: the CuMatrix version of the Invert() function will only work for positive definite matrices; it...
The following class is used to simulate non-const references to Real, e.g.
const SpMatrix< Real > & Mat() const
void CopyFromSp(const SpMatrix< Real > &other)
double TraceSpSp(const SpMatrix< double > &A, const SpMatrix< double > &B)
This class is used for a piece of a CuMatrix.
bool IsUnit(Real tol=0.001) const
Real FrobeniusNorm() const
void CopyFromMat(const CuMatrixBase< Real > &orig, SpCopyType copy_type=kTakeLower)
void CopyToSp(SpMatrix< Real > *dst) const
void Resize(MatrixIndexT nRows, MatrixResizeType resize_type=kSetZero)
void CopyFromSp(const CuSpMatrix< Real > &other)
Matrix for CUDA computing.
void AddSp(const Real alpha, const CuSpMatrix< Real > &Ma)
#define KALDI_ASSERT(cond)
Matrix for CUDA computing.
static void AssertEqual(float a, float b, float relative_tolerance=0.001)
assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b))
friend R TraceSpSp(const CuSpMatrix< R > &A, const CuSpMatrix< S > &B)
void Resize(MatrixIndexT nRows, MatrixResizeType resize_type=kSetZero)
Set packed matrix to a specified size (can be zero).
CuSpMatrix(const CuSpMatrix< Real > &orig)
CuSpMatrix(const CuMatrixBase< Real > &orig, SpCopyType copy_type=kTakeLower)
void AddMat2(const Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType transM, const Real beta)
void CopyFromPacked(const CuPackedMatrix< Real > &src)
Vector for CUDA computing.
CuSpMatrix(const SpMatrix< Real > &orig)
void AddVec2(const Real alpha, const CuVectorBase< Real > &v)
bool ApproxEqual(const CuSpMatrix< Real > &other, Real tol=0.001) const