Closed tanujkhattar closed 1 month ago
Addressed all the comments. Also realized that its a bit annoying to have HasLength
as a drop-in replacement where len(cvs)
just returns a symbolic value because of the way python treats the __len__
dunder method. Explained in the docstring and added a workaround. Merging now
Also realized that its a bit annoying to have
HasLength
as a drop-in replacement wherelen(cvs)
just returns a symbolic value because of the way python treats the__len__
dunder method.
@tanujkhattar fwiw, I faced the same issue when implementing Shaped
, my workaround was to define slen
:
https://github.com/quantumlib/Qualtran/blob/5aabc66c37bd4c8e8b330a896b98178109c5bd34/qualtran/symbolics/math_funcs.py#L102-L105
We should extend this by adding HasLength
to the input type here.
and/or make HasLength be a subclass of Shaped
Part of a larger effort to better support symbolic resource estimation across bloqs. I will update the
cvs
parameter on other bloqs in follow-up PRs.