/** * Accumulate covariance matrix (ncycle * NBASE x ncycle * NBASE). * Only lower triangular matrix is accumulated. * Note: If V is NULL, the required memory is allocated. * - p: Matrix of processed intensities * - lambda: Brightness of cluster * - base: Current base call * - do_full: Calculate full covariance matrix, or just band suitable for fitting Omega * - V: Covariance matrix used for accumulation */ static MAT accumulate_covariance( const real_t we, const MAT p, const real_t lambda, const NUC * base, const bool do_full, MAT V) { validate(NULL!=p, NULL); validate(NBASE==p->nrow, NULL); validate(lambda>=0.0, NULL); const uint_fast32_t ncycle = p->ncol; const int lda = ncycle * NBASE; // Allocate memory for V if necessary if (NULL==V) { V = new_MAT(lda, lda); if (NULL==V) { return NULL; } } // Perform accumulation. V += R R^t // Note: R = P - \lambda I_b, where I_b is unit vector with b'th elt = 1 for (uint_fast32_t cy = 0; cy < ncycle; cy++) { if (!isambig(base[cy])) { p->x[cy * NBASE + base[cy]] -= lambda; } } if ( do_full ) { syr(LAPACK_LOWER, &lda, &we, p->x, LAPACK_UNIT, V->x, &lda); } else { // Only update base*base blocks on the diagonal or immediately above and below it // Update more elements than necessary but excess are ignored later. for ( int i=0 ; i<lda ; i++) { for ( int j=i ; j<i+2*NBASE ; j++ ) { if(j>=lda) { break; } V->x[i*lda+j] += we * p->x[i] * p->x[j]; } } } return V; }
void MTLmarks::DmatVecRun(std::string benchmark) { if(benchmark == "dmatvecmult"){ mtl_result = dmatvecmult(size, steps); } else if(benchmark == "gemv1"){ mtl_result = gemv1(size, steps); } else if(benchmark == "gemv2"){ mtl_result = gemv2(size, steps); } else if(benchmark == "ger1"){ mtl_result = ger1(size, steps); } else if(benchmark == "syr"){ mtl_result = syr(size, steps); } else if(benchmark == "trmv1"){ mtl_result = trmv1(size, steps); } else if(benchmark == "trmv2"){ mtl_result = trmv2(size, steps); } else if(benchmark == "cmajordmvmult"){ mtl_result = cmajordmvmult(size, steps); } else if(benchmark == "rmajordmvmult"){ mtl_result = rmajordmvmult(size, steps); } else if(benchmark == "custom"){ mtl_result = custom(size, steps); } else{ std::cerr << "Ublasmarks benchmark does not exist." << std::endl; exit(1); } }