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

Function test_dense_encoding

test/QAlg/Encode.test.cpp:46–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 return true;
45}
46static bool test_dense_encoding()
47{
48 auto qvm = new CPUQVM();
49 qvm->init();
50 //std::vector<double>data{ 0.4737709042140123,0.5287790950369405,0.2157088373614705,0.023769834145903144,0.4019987624599187,0.057654140832877024,0.5150212867886899,0.1366183026575457 };
51 std::vector<double>data{ PI,PI,PI };
52 QProg prog;
53 auto q = qvm->qAllocMany(15);
54 Encode encode_b;
55 encode_b.dense_angle_encode(q, data);
56 prog << encode_b.get_circuit();
57 qvm->directlyRun(prog);
58 std::cout << prog << std::endl;
59 auto result = qvm->probRunDict(prog, encode_b.get_out_qubits(), -1);
60 for (auto &val : result)
61 {
62 std::cout << val.first << ':' << val.second << std::endl;
63 }
64 destroyQuantumMachine(qvm);
65 return true;
66}
67static bool test_ds_quantum_state_preparation_encoding()
68{
69 auto qvm = new CPUQVM();

Callers 1

TESTFunction · 0.85

Calls 7

initMethod · 0.45
qAllocManyMethod · 0.45
dense_angle_encodeMethod · 0.45
get_circuitMethod · 0.45
directlyRunMethod · 0.45
probRunDictMethod · 0.45
get_out_qubitsMethod · 0.45

Tested by

no test coverage detected