Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/quantum-pecos/src/pecos/engines/cvm/classical.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def eval_cop(

# Eval assignment
# ---------------
expr_eval = recur_eval_op(cop_expr, output, width, shot_id)
expr_eval = recur_eval_op(cop_expr, output, width, shot_id=shot_id)

# Assign the final value:
# -----------------------
Expand Down Expand Up @@ -361,7 +361,6 @@ def eval_condition(
a = conditional_expr["a"]
b = conditional_expr["b"]
op = conditional_expr["op"]

if isinstance(a, str):
a = output[a] # str -> BinArray
elif isinstance(a, tuple | list) and len(a) == 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def run(
Tuple of final simulator state and output dictionary.
"""
output = set_output(state, circuit, output_spec, output)
output["JOB_shotnum"] = shot_id
output_export = {}

self.circuit = circuit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ RNGindex(JOB_shotnum);

h q;
hgates1[0] = 1;
if (JOB_shotnum == 2) h q;
if (JOB_shotnum == 4) h q;
cond1 = JOB_shotnum + JOB_shotnum + 10;
if (cond1 == 4) h q;

cond1 = RNGnum();
if (cond1[0] != 0) h q;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5];
creg c[5];

creg cond1[32];
creg hgates1[4];

/////////////////////////////////////////////
// Test RNG functions with jobvar index
/////////////////////////////////////////////

RNGseed(1000);
RNGbound(16);
RNGindex(JOB_shotnum);

h q;
hgates1[0] = 1;

cond1 = RNGnum();
cond1 = cond1 % 7;
if (cond1[0] != 0) h q;
if (cond1[0] != 0) hgates1[1] = 1;

cond1 = RNGnum();
cond1 = cond1 % 7;
if (cond1[1] != 0) h q;
if (cond1[1] != 0) hgates1[2] = 1;

cond1 = RNGnum();
cond1 = cond1 % 7;
if (cond1[3] != 0) h q;
if (cond1[3] != 0) hgates1[3] = 1;

measure q->c;
Loading