示例#1
0
 void DM::sandwich_inplace(SpdMatrix &m) const {
   assert((nrow() == m.nrow()) && (m.ncol() == ncol()));
   for (int i = 0; i < nrow(); ++i) {
     m.row(i) *= diagonal_elements_[i];
     m.col(i) *= diagonal_elements_[i];
   }
 }
示例#2
0
文件: SpdMatrix.cpp 项目: Hkey1/boom
 SpdMatrix sandwich(const Matrix &A, const SpdMatrix &V){  // AVA^T
   Matrix tmp(A.nrow(), V.ncol());
   cblas_dsymm(CblasColMajor, CblasRight, CblasUpper,
     	  tmp.nrow(),
     	  tmp.ncol(),
     	  1.0,
     	  V.data(),
     	  V.nrow(),
     	  A.data(),
     	  A.nrow(),
     	  0.0,
     	  tmp.data(),
     	  tmp.nrow());
   return matmultT(tmp, A);
 }