phase_estimation.py contains the following block of code:
self._block_encoding = block_encoding
self._block_encoding_ctl = getEncoding( instance=self._block_encoding.PI,
encoding=self._block_encoding._encoding_type,
control_val=1 )
The getEncoding call returns a new encoding of the same type as block_encoding, by comparing the type of block_encoding to the explicit list of all pyLIQTR-provided block encodings. If block_encoding is some other type (e.g., a user-defined type), an error is raised.
I think the explicit list of block-encoding types could be removed by replacing the getEncoding call with something like this:
self._block_encoding_ctl = type(block_encoding)( ...,
control_val=1 )
phase_estimation.pycontains the following block of code:The
getEncodingcall returns a new encoding of the same type asblock_encoding, by comparing the type ofblock_encodingto the explicit list of all pyLIQTR-provided block encodings. Ifblock_encodingis some other type (e.g., a user-defined type), an error is raised.I think the explicit list of block-encoding types could be removed by replacing the
getEncodingcall with something like this: