trunk:src/cudamatrix minor fix of cu-matrix-test for compilation compatiable across diffferent g++ version

git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@3247 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
This commit is contained in:
Ho Yin Chan 2013-12-03 16:09:49 +00:00
Родитель ea9909ce5b
Коммит 1fd24ed1a7
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -835,15 +835,19 @@ static void UnitTestCuMatrixSymInvertPosDef() {
Real alpha = 0.3, beta = 1.75432;
M.SymAddMat2(alpha, N, trans, beta);
// M.AddMatMat(alpha, N, trans, N, other_trans, beta);
SpMatrix<Real> S(CuSpMatrix<Real>(M, kTakeLower));
CuSpMatrix<Real> spTemp(M, kTakeLower);
SpMatrix<Real> S(spTemp);
S.Invert();
CuMatrix<Real> M_orig(CuSpMatrix<Real>(M, kTakeLower));
CuSpMatrix<Real> spTemp2(M, kTakeLower);
CuMatrix<Real> M_orig(spTemp2);
M.SymInvertPosDef();
CuMatrix<Real> M_inverted(CuSpMatrix<Real>(M, kTakeLower));
CuSpMatrix<Real> spTemp3(M, kTakeLower);
CuMatrix<Real> M_inverted(spTemp3);
CuMatrix<Real> M_prod(dimM, dimM);
M_prod.AddMatMat(Real(1.0), M_orig, kNoTrans, M_inverted, kNoTrans, Real(0.0));
KALDI_ASSERT(M_prod.IsUnit());
SpMatrix<Real> S2(CuSpMatrix<Real>(M, kTakeLower));
CuSpMatrix<Real> spTemp4(M, kTakeLower);
SpMatrix<Real> S2(spTemp4);
KALDI_ASSERT(ApproxEqual(S, S2, (Real)0.1));
KALDI_ASSERT(dimM == 0 || S.Trace() != 0);
}