Skip to content

Commit

Permalink
simplified int encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
positr0nium committed Jul 5, 2024
1 parent 53e692c commit e2107cf
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/qrisp/misc/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ def true_fun(qc, cond, qb):
def false_fun(qc, cond, qb):
return qc

def loop_fun(i, val):
def loop_fun(i, qc):
cond_bool = (1<<i) & encoding_number
qb = val[1][i]
qc = cond(cond_bool, true_fun, false_fun, val[0], cond_bool, qb)
return (qc, val[1])

qc, qv = fori_loop(0, qv.size, loop_fun, (tr_qs.abs_qc, qv))
qb = qv[i]
qc = cond(cond_bool, true_fun, false_fun, qc, cond_bool, qb)
return qc

qc = fori_loop(0, qv.size, loop_fun, (tr_qs.abs_qc))
tr_qs.abs_qc = qc


Expand Down

0 comments on commit e2107cf

Please sign in to comment.