-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock_encoding.h
More file actions
43 lines (34 loc) · 1.3 KB
/
block_encoding.h
File metadata and controls
43 lines (34 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef BLOCK_ENCODING_H
#define BLOCK_ENCODING_H
#include "ThirdParty/Eigen/Eigen"
#include "Core/QuantumCircuit/QCircuit.h"
using namespace Eigen;
using namespace QPanda;
struct block_encoding_res {
MatrixXcd unitary;
float subfactor = 1.0;
QCircuit circuit;
block_encoding_res() {}
block_encoding_res(MatrixXcd unitary, float subfactor=1.0): unitary(unitary), subfactor(subfactor) {}
block_encoding_res(MatrixXcd unitary, float subfactor, QCircuit circuit): unitary(unitary), subfactor(subfactor), circuit(circuit) {}
};
bool check_block_encoding(block_encoding_res &res, MatrixXcd &A, float eps=1e-5);
enum struct BlockEncodingMethod {
// directly construct
QSVT = 10,
QSVT0 = 11,
// prepare-select based
LCU = 20,
// query-oracle based
ARCSIN = 30,
FABLE = 31,
};
MatrixXcd block_encoding(MatrixXcd A, BlockEncodingMethod method=BlockEncodingMethod::ARCSIN);
block_encoding_res block_encoding_QSVT(MatrixXcd A);
block_encoding_res block_encoding_QSVT0(MatrixXcd A);
block_encoding_res block_encoding_LCU(MatrixXcd A, float eps=1e-8);
block_encoding_res block_encoding_ARCSIN(MatrixXcd A, float eps=1e-8);
block_encoding_res block_encoding_FABLE(MatrixXcd A, float eps=1e-8);
// ↓↓ keep signature for the contest solution
MatrixXcd block_encoding_method(MatrixXcd A);
#endif