#include <matrix-common.h>


Public Member Functions | |
| CuSpMatrix () | |
| CuSpMatrix (MatrixIndexT r, MatrixResizeType resize_type=kSetZero) | |
| CuSpMatrix (const SpMatrix< Real > &orig) | |
| CuSpMatrix (const CuSpMatrix< Real > &orig) | |
| CuSpMatrix (const CuMatrixBase< Real > &orig, SpCopyType copy_type=kTakeLower) | |
| CuSpMatrix< Real > & | operator= (const CuSpMatrix< Real > &in) |
| ~CuSpMatrix () | |
| void | Resize (MatrixIndexT nRows, MatrixResizeType resize_type=kSetZero) |
| Real | FrobeniusNorm () const |
| bool | IsUnit (Real tol=0.001) const |
| bool | ApproxEqual (const CuSpMatrix< Real > &other, Real tol=0.001) const |
| void | CopyFromSp (const CuSpMatrix< Real > &other) |
| void | CopyFromSp (const SpMatrix< Real > &other) |
| void | CopyFromMat (const CuMatrixBase< Real > &orig, SpCopyType copy_type=kTakeLower) |
| void | CopyToSp (SpMatrix< Real > *dst) const |
| CuValue< Real > | operator() (MatrixIndexT r, MatrixIndexT c) |
| Real | operator() (MatrixIndexT r, MatrixIndexT c) const |
| void | Invert () |
| Note: the CuMatrix version of the Invert() function will only work for positive definite matrices; it is based on Cholesky. More... | |
| void | AddVec2 (const Real alpha, const CuVectorBase< Real > &v) |
| void | AddMat2 (const Real alpha, const CuMatrixBase< Real > &M, MatrixTransposeType transM, const Real beta) |
| void | AddSp (const Real alpha, const CuSpMatrix< Real > &Ma) |
Public Member Functions inherited from CuPackedMatrix< Real > | |
| CuPackedMatrix () | |
| CuPackedMatrix (MatrixIndexT r, MatrixResizeType resize_type=kSetZero) | |
| CuPackedMatrix (const PackedMatrix< Real > &orig) | |
| CuPackedMatrix (const CuPackedMatrix< Real > &orig) | |
| void | SetZero () |
| void | SetUnit () |
| < Set to zero More... | |
| void | SetRandn () |
| < Set to unit matrix. More... | |
| void | SetDiag (Real alpha) |
| < Set to random values of a normal distribution More... | |
| void | AddToDiag (Real r) |
| < Set the diagonal value to alpha More... | |
| void | Scale (Real alpha) |
| void | ScaleDiag (Real alpha) |
| Real | Trace () const |
| ~CuPackedMatrix () | |
| void | Resize (MatrixIndexT nRows, MatrixResizeType resize_type=kSetZero) |
| Set packed matrix to a specified size (can be zero). More... | |
| void | CopyFromPacked (const CuPackedMatrix< Real > &src) |
| void | CopyFromPacked (const PackedMatrix< Real > &src) |
| void | CopyToPacked (PackedMatrix< Real > *dst) const |
| void | Read (std::istream &in, bool binary) |
| void | Write (std::ostream &out, bool binary) const |
| void | Destroy () |
| void | Swap (CuPackedMatrix< Real > *other) |
| Swaps the contents of *this and *other. Shallow swap. More... | |
| void | Swap (PackedMatrix< Real > *other) |
| Swaps the contents of *this and *other. More... | |
| Real * | Data () |
| const Real * | Data () const |
| Real | operator() (MatrixIndexT r, MatrixIndexT c) const |
| MatrixIndexT | NumRows () const |
| MatrixIndexT | NumCols () const |
| size_t | SizeInBytes () const |
| Returns size in bytes of the data held by the matrix. More... | |
Protected Member Functions | |
| const SpMatrix< Real > & | Mat () const |
| SpMatrix< Real > & | Mat () |
Protected Member Functions inherited from CuPackedMatrix< Real > | |
| const PackedMatrix< Real > & | Mat () const |
| PackedMatrix< Real > & | Mat () |
| void | AddPacked (const Real alpha, const CuPackedMatrix< Real > &M) |
Friends | |
| class | CuMatrixBase< Real > |
| class | CuVectorBase< Real > |
| class | CuTpMatrix< Real > |
| class | CuSubMatrix< Real > |
| class | CuRand< Real > |
| template<class R , class S > | |
| R | TraceSpSp (const CuSpMatrix< R > &A, const CuSpMatrix< S > &B) |
Additional Inherited Members | |
Protected Attributes inherited from CuPackedMatrix< Real > | |
| Real * | data_ |
| MatrixIndexT | num_rows_ |
Definition at line 76 of file matrix-common.h.
|
inline |
Definition at line 52 of file cu-sp-matrix.h.
|
inlineexplicit |
Definition at line 54 of file cu-sp-matrix.h.
|
inlineexplicit |
Definition at line 57 of file cu-sp-matrix.h.
|
inline |
Definition at line 62 of file cu-sp-matrix.h.
|
inlineexplicit |
Definition at line 65 of file cu-sp-matrix.h.
References CuSpMatrix< Real >::CopyFromMat(), and CuSpMatrix< Real >::operator=().
|
inline |
Definition at line 73 of file cu-sp-matrix.h.
| void AddMat2 | ( | const Real | alpha, |
| const CuMatrixBase< Real > & | M, | ||
| MatrixTransposeType | transM, | ||
| const Real | beta | ||
| ) |
Definition at line 130 of file cu-sp-matrix.cc.
References CuMatrixBase< Real >::Data(), KALDI_ASSERT, kaldi::kNoTrans, kaldi::kTakeLower, kaldi::kTrans, CuMatrixBase< Real >::Mat(), CuMatrixBase< Real >::NumCols(), CuMatrixBase< Real >::NumRows(), and CuMatrixBase< Real >::Stride().
Referenced by CuSpMatrix< Real >::operator()(), OnlinePreconditioner::SelfTest(), OnlineNaturalGradient::SelfTest(), kaldi::UnitTestCuSpMatrixAddMat2(), kaldi::UnitTestCuSpMatrixInvert(), and kaldi::nnet2::UnitTestPreconditionDirections().
|
inline |
Definition at line 127 of file cu-sp-matrix.h.
References CuPackedMatrix< Real >::AddPacked().
Referenced by kaldi::UnitTestCuSpMatrixAddSp().
| void AddVec2 | ( | const Real | alpha, |
| const CuVectorBase< Real > & | v | ||
| ) |
Definition at line 108 of file cu-sp-matrix.cc.
References CU2DBLOCK, CuVectorBase< Real >::Data(), CuVectorBase< Real >::Dim(), KALDI_ASSERT, and CuVectorBase< Real >::Vec().
Referenced by CuSpMatrix< Real >::operator()(), kaldi::UnitTestCuSpMatrixAddVec2(), and kaldi::nnet2::UnitTestPreconditionDirections().
| bool ApproxEqual | ( | const CuSpMatrix< Real > & | other, |
| Real | tol = 0.001 |
||
| ) | const |
Definition at line 200 of file cu-sp-matrix.cc.
References rnnlm::d, CuSpMatrix< Real >::FrobeniusNorm(), KALDI_ASSERT, and CuPackedMatrix< Real >::NumRows().
Referenced by kaldi::AssertEqual(), and CuSpMatrix< Real >::FrobeniusNorm().
| void CopyFromMat | ( | const CuMatrixBase< Real > & | orig, |
| SpCopyType | copy_type = kTakeLower |
||
| ) |
Definition at line 39 of file cu-sp-matrix.cc.
References CU1DBLOCK, CU2DBLOCK, CuMatrixBase< Real >::Data(), data_, CuMatrixBase< Real >::Dim(), KALDI_ASSERT, KALDI_ERR, kaldi::kTakeLower, kaldi::kTakeMean, kaldi::kTakeMeanAndCheck, kaldi::kTakeUpper, CuMatrixBase< Real >::Mat(), CuMatrixBase< Real >::NumCols(), and CuMatrixBase< Real >::NumRows().
Referenced by CuMatrixBase< float >::Cholesky(), CuSpMatrix< Real >::CopyFromSp(), CuSpMatrix< Real >::CuSpMatrix(), kaldi::UnitTestCopyFromMat(), and kaldi::UnitTestCuSpMatrixCopyFromMat().
|
inline |
Definition at line 85 of file cu-sp-matrix.h.
References CuPackedMatrix< Real >::CopyFromPacked().
Referenced by kaldi::UnitTestCuSpMatrixOperator().
|
inline |
Definition at line 88 of file cu-sp-matrix.h.
References CuSpMatrix< Real >::CopyFromMat(), CuPackedMatrix< Real >::CopyFromPacked(), and kaldi::kTakeLower.
|
inline |
Definition at line 95 of file cu-sp-matrix.h.
References CuPackedMatrix< Real >::CopyToPacked().
Referenced by kaldi::UnitTestConstructor(), kaldi::UnitTestCopyFromMat(), kaldi::UnitTestCuSpMatrixAddMat2(), kaldi::UnitTestCuSpMatrixAddSp(), kaldi::UnitTestCuSpMatrixAddToDiag(), kaldi::UnitTestCuSpMatrixAddVec2(), kaldi::UnitTestCuSpMatrixConstructor(), and kaldi::UnitTestCuSpMatrixInvert().
|
inline |
Definition at line 79 of file cu-sp-matrix.h.
References CuSpMatrix< Real >::ApproxEqual(), CuSpMatrix< Real >::IsUnit(), and CuSpMatrix< Real >::TraceSpSp.
Referenced by CuSpMatrix< Real >::ApproxEqual().
| void Invert | ( | ) |
Note: the CuMatrix version of the Invert() function will only work for positive definite matrices; it is based on Cholesky.
Definition at line 93 of file cu-sp-matrix.cc.
References CuMatrixBase< Real >::CopyFromSp(), and CuMatrixBase< Real >::SymInvertPosDef().
Referenced by CuSpMatrix< Real >::operator()(), kaldi::UnitTestCuSpMatrixInvert(), and kaldi::nnet2::UnitTestPreconditionDirections().
| bool IsUnit | ( | Real | tol = 0.001 | ) | const |
Definition at line 210 of file cu-sp-matrix.cc.
References kaldi::TraceSpSp().
Referenced by CuSpMatrix< Real >::FrobeniusNorm().
|
inlineprotected |
Definition at line 132 of file cu-sp-matrix.h.
Referenced by CuVectorBase< float >::AddSpVec(), CuTpMatrix< Real >::Cholesky(), CuMatrixBase< float >::CopyFromSp(), and kaldi::TraceSpSp().
|
inlineprotected |
Definition at line 135 of file cu-sp-matrix.h.
|
inline |
Definition at line 99 of file cu-sp-matrix.h.
References CuPackedMatrix< Real >::data_, KALDI_ASSERT, CuPackedMatrix< Real >::num_rows_, and kaldi::swap().
|
inline |
Definition at line 108 of file cu-sp-matrix.h.
References CuSpMatrix< Real >::AddMat2(), CuSpMatrix< Real >::AddVec2(), CuPackedMatrix< Real >::data_, CuSpMatrix< Real >::Invert(), KALDI_ASSERT, CuPackedMatrix< Real >::num_rows_, and kaldi::swap().
| CuSpMatrix< Real > & operator= | ( | const CuSpMatrix< Real > & | in | ) |
Definition at line 226 of file cu-sp-matrix.cc.
References kaldi::kUndefined, and CuPackedMatrix< Real >::NumRows().
Referenced by CuSpMatrix< Real >::CuSpMatrix().
|
inline |
Definition at line 75 of file cu-sp-matrix.h.
References CuPackedMatrix< Real >::Resize().
Referenced by SpMatrix< float >::SpMatrix().
|
friend |
Definition at line 42 of file cu-sp-matrix.h.
|
friend |
Definition at line 46 of file cu-sp-matrix.h.
|
friend |
Definition at line 45 of file cu-sp-matrix.h.
|
friend |
Definition at line 44 of file cu-sp-matrix.h.
|
friend |
Definition at line 43 of file cu-sp-matrix.h.
|
friend |
Referenced by CuSpMatrix< Real >::FrobeniusNorm().