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

Function MprodcutA

Applications/HHL_Algorithm/BasicFunctionByOrigin.cpp:246–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246SparseQMatrix<double> MprodcutA(SparseQMatrix<double>& M, SparseQMatrix<double>& A, int SparseIndex) {
247 int size = A.size;
248
249 vector<vector<pair<int, double>>> sparse_dataM(size);
250
251#pragma omp for
252 for (int i = 0; i < size; i++) {
253 auto rowV = M.getSparseEigenRowVector(i);
254 for (int j = 0; j < size; j++) {
255 auto colV = A.getSparseEigenColVector(j);
256 auto val = rowV.dot(colV);
257 if (val != 0) {
258 sparse_dataM[i].emplace_back(j, val);
259 }
260 }
261 }
262 SparseQMatrix<double> MA;
263 FastTransfer2SparseQMat(sparse_dataM.data(), size, MA);
264 return MA;
265}
266
267VectorXd MproductbDen(const SparseQMatrix<double>& M, const VectorXd &b) {
268 int size = M.size;

Callers 1

preconditionFunction · 0.85

Calls 6

FastTransfer2SparseQMatFunction · 0.85
dotMethod · 0.45
emplace_backMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected