Add Product block encoding - #1106
Conversation
mpharrigan
left a comment
There was a problem hiding this comment.
Some minor things to consider, but LGTM
tanujkhattar
left a comment
There was a problem hiding this comment.
Please add an explanation of the decomposition to the docstring and consider doing the partitions and unpartitions once outside the for-loop
|
I will do the suggested refactor to clean up the circuit diagram in a follow-up PR. @mpharrigan I've addressed all of the other feedback. |
| 'product_block_encoding', | ||
| 'product_block_encoding_override', | ||
| 'product_block_encoding_symb', |
There was a problem hiding this comment.
Why are these not serializable ?
There was a problem hiding this comment.
@charlesyuan314 I'll merge the PR and we can continue this discussion and potentially address in a follow-up PR
There was a problem hiding this comment.
I believe it is because this bloq has an attribute of type Tuple[BlockEncoding, ...]. It results in the following at serialization time:
qualtran.testing.BloqCheckException: Serialization Failed:
Object arrays cannot be saved when allow_pickle=False
Are bloqs contained as attributes something that can be made serializable?
There was a problem hiding this comment.
Object arrays cannot be saved when allow_pickle=False
I think it's because so far we haven't had any bloq that stores a sequence of subbloqs as an attribute.
To support serialization we'll have to update
Qualtran/qualtran/protos/bloq.proto
Line 40 in f8d2db0
NDArray subbloqs that stores an NDArray of integers corresponding to IDs of each of the subbloqs and then update Qualtran/qualtran/serialization/bloq.py
Line 349 in f8d2db0
Can you please open an issue to track this?
Add an instance of
BlockEncodingthat implements the product of constituent block encodings.