Skip to content

Commit e467b60

Browse files
correct uncomputation issue
1 parent 0e902fd commit e467b60

File tree

4 files changed

+52
-57
lines changed

4 files changed

+52
-57
lines changed

applications/finance/value_at_risk/value_at_risk.metadata.json renamed to applications/finance/value_at_risk/Persik.metadata.json

File renamed without changes.

applications/finance/value_at_risk/Persik.qmod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ qstruct OptionPricingState {
33
ind: qbit;
44
}
55

6-
qfunc iqae_algorithm(k: int, oracle_operand: qfunc (qbit[]), sp_operand: qfunc (qbit[]), x: qbit[]) {
6+
qfunc iqae_algorithm(k: int, oracle_operand: qperm (qbit[]), sp_operand: qfunc (qbit[]), x: qbit[]) {
77
sp_operand(x);
88
power (k) {
99
grover_operator(oracle_operand, sp_operand, x);
@@ -147,9 +147,13 @@ qfunc load_distribution(asset: qnum) {
147147
], 0, asset);
148148
}
149149

150+
qperm payoff(const asset: qnum, ind: qbit) {
151+
ind ^= asset < 34;
152+
}
153+
150154
qfunc state_preparation(state: OptionPricingState) {
151155
load_distribution(state.asset);
152-
state.ind ^= state.asset < 34;
156+
payoff(state.asset, state.ind);
153157
}
154158

155159
qfunc main(k: int, output ind: qbit) {
@@ -158,4 +162,5 @@ qfunc main(k: int, output ind: qbit) {
158162
iqae_algorithm(k, iqae_oracle, state_preparation, state);
159163
asset: qnum<7>;
160164
state -> {asset, ind};
165+
drop(asset);
161166
}

applications/finance/value_at_risk/Persik.synthesis_options.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
"preferences": {
77
"custom_hardware_settings": {
88
"basis_gates": [
9-
"y",
10-
"id",
11-
"z",
12-
"r",
9+
"sxdg",
10+
"cz",
11+
"h",
1312
"cy",
13+
"s",
14+
"cx",
1415
"rx",
15-
"sx",
16-
"ry",
17-
"rz",
1816
"x",
19-
"u",
20-
"s",
21-
"h",
22-
"cz",
23-
"u2",
24-
"t",
2517
"sdg",
26-
"cx",
18+
"y",
19+
"u1",
20+
"u",
2721
"tdg",
22+
"rz",
23+
"ry",
24+
"r",
25+
"u2",
26+
"z",
27+
"sx",
2828
"p",
29-
"u1",
30-
"sxdg"
29+
"t",
30+
"id"
3131
],
3232
"is_symmetric_connectivity": true
3333
},
@@ -36,7 +36,7 @@
3636
"optimization_level": 1,
3737
"output_format": ["qasm"],
3838
"pretty_qasm": true,
39-
"random_seed": 2331998045,
39+
"random_seed": 2641333644,
4040
"synthesize_all_separately": false,
4141
"timeout_seconds": 300,
4242
"transpilation_option": "auto optimize"

applications/finance/value_at_risk/value_at_risk.ipynb

Lines changed: 28 additions & 38 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)