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); }
void local_add_outer(SpdMatrix &S, const V &v, double w){ assert(v.size()==S.nrow()); cblas_dsyr(CblasColMajor, CblasUpper, v.size(), w, v.data(), v.stride(), S.data(), S.nrow()); }