MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / MproductbDen

Function MproductbDen

Applications/HHL_Algorithm/BasicFunctionByOrigin.cpp:267–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267VectorXd MproductbDen(const SparseQMatrix<double>& M, const VectorXd &b) {
268 int size = M.size;
269 VectorXd Mb(size);
270 auto data = M.data;
271 auto col_ptr = M.nnzcol_ptr;
272 auto col_ind = M.nnzcol_ind;
273 if (size == 0) {
274 cout << "wrong is here" << endl;
275 }
276#pragma omp parallel for
277 for (int i = 0; i < size; i++) {
278 double sum = 0;
279 for (int j = col_ptr[i]; j < col_ptr[i + 1]; j++) {
280 auto temp = data[j] * b(col_ind[j]);
281 sum += temp;
282 }
283 Mb(i) = sum;
284 }
285
286 return Mb;
287}
288
289vector<double> MproductbDen(const SparseQMatrix<double>& M, const vector<double>& b) {
290 int size = M.size;

Callers 2

preconditionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected