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. 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.
Amplitude Threshold
By default, state vector simulation filters out states with exactly zero amplitude from the result. You can tighten this filter by settingamplitude_threshold in ExecutionPreferences to exclude states whose amplitude magnitude is below a given threshold:
|amplitude| <= amplitude_threshold are excluded from results. This reduces the size of the result for circuits where most amplitudes are negligibly small (e.g. block-encoded circuits).
Setting
include_zero_amplitude_outputs=True overrides amplitude_threshold and includes all states regardless of amplitude.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.