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

Method amplitude_encode_recursive

QAlg/Encode/Encode.cpp:93–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void Encode::amplitude_encode_recursive(const QVec &q, const std::vector<double>& data)
94{
95 vector<double>data_temp(data);
96
97 if (!_check_normalized(data_temp)) {
98 throw run_fail("Data is not normalized");
99 }
100
101 if (data.size() > (1 << q.size()))
102 {
103 throw run_fail("Amplitude_encode parameter error.");
104 }
105
106 while (data_temp.size() < (1 << q.size()))
107 {
108 data_temp.push_back(0);
109 }
110 m_qcircuit = _recursive_compute_beta(q, data_temp);
111
112 m_out_qubits = q;
113
114 return;
115}
116
117void Encode::amplitude_encode_recursive(const QVec &qubits, const QStat& full_cur_vec)
118{

Callers 1

test_Amplitude_encoding4Function · 0.45

Calls 10

run_failClass · 0.85
SWAPClass · 0.85
sqrtFunction · 0.50
argFunction · 0.50
absFunction · 0.50
expFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45
realMethod · 0.45
imagMethod · 0.45

Tested by 1

test_Amplitude_encoding4Function · 0.36