State Vector Filtering
Before measurement, a quantum circuit creates a state which can be described as a vector of amplitudes, where is the number of qubits. Though this state vector cannot be directly accessed on a quantum computer (as measurement destroys the state), certain quantum simulators make this information available. Classiq supports two simulators which return the full statevector, both under the Classiq provider:simulator_statevector and nvidia_simulator_statevector.
Since the data size grows exponentially, large circuits cannot be simulated.
However, in certain applications such as those that use block encoding, not all
of the amplitudes are of interest. For example, some methods of
post-processing discard certain results wholesale, and thus the amplitudes
corresponding to those measured states are irrelevant.
In these instances, filtering out the amplitudes that are not of interest can
greatly save memory and network footprint. Use the method
ExecutionSession.set_measured_state_filter, to specify the execution output
values of interest.
Example
results will contain only the amplitudes that correspond
to states where x is 1 and y is 2.
Limitations
Currently, filtering is only available on Classiq’ssimulator_statevector
(ClassiqSimulatorBackendNames.SIMULATOR_STATEVECTOR) and
nvidia_simulator_statevector (ClassiqNvidiaBackendNames.SIMULATOR_STATEVECTOR).
Filtering is only available for quantum scalars (QuantumBits and QuantumNumerics).
Additionally, only a single value per variable is supported. For example,
session.set_measured_state_filter("x", lambda x: x < 5) is not allowed.