Skip to content

Commit a897b34

Browse files
petim0mpharrigan
andauthored
Fix RowColumnOracle Signature (#1780)
The row and column oracle are defined as such ([Lin Lin (2022). Ch. 6.5.](https://arxiv.org/abs/2201.08309)): $O_c\ket{\ell}\ket{j}=\ket{c(j, \ell)}\ket{j}$, where $c(j,\ell)$ gives the $\ell$-th non zero entry in the $j$-th column. So indeed, in input the value of l is bounded by the number of non zero entries in the matrix. But in output, the value of $c(j,\ell)$ is unbounded as the $\ell$-th non zero entry can be anywhere in the column. So the Signature of `RowColumnOracle` is incorrect and that was making `assert_consistent_classical_action` throwing errors it should not have. This is fixed by this PR. Co-authored-by: Matthew Harrigan <mpharrigan@google.com>
1 parent a08fbe1 commit a897b34

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

qualtran/bloqs/block_encoding/sparse_matrix.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
QInt,
3434
QUInt,
3535
Register,
36+
Side,
3637
Signature,
3738
Soquet,
3839
SoquetT,
@@ -94,8 +95,12 @@ def __attrs_post_init__(self):
9495

9596
@cached_property
9697
def signature(self) -> Signature:
97-
return Signature.build_from_dtypes(
98-
l=BQUInt(self.system_bitsize, self.num_nonzero), i=QUInt(self.system_bitsize)
98+
return Signature(
99+
[
100+
Register("l", BQUInt(self.system_bitsize, self.num_nonzero), side=Side.LEFT),
101+
Register("l", QUInt(self.system_bitsize), side=Side.RIGHT),
102+
Register("i", QUInt(self.system_bitsize)),
103+
]
99104
)
100105

101106

0 commit comments

Comments
 (0)