Neat
class Neat(backend, noise_model=None)
A class to help understand the expected performance of estimator jobs.
The “Noisy Estimator Analyzer Tool” (or “NEAT”) is a convenience tool that users of the Estimator
primitive can employ to analyze and predict the performance of their queries. Its simulate method uses qiskit-aer
to simulate the estimation task classically efficiently, either in ideal conditions or in the presence of noise. The simulations’ results can be compared with other simulation results or with primitive results results to draw custom figures of merit.
Parameters
- backend (
BackendV2
) – A backend. - noise_model (
Optional
[NoiseModel
]) – A noise model for the operations of the given backend. IfNone
, it defaults to the noise model generated byNoiseModel.from_backend()
.
Attributes
noise_model
Methods
backend
ideal_sim
ideal_sim(pubs, cliffordize=False, seed_simulator=None, precision=0)
Perform an ideal, noiseless simulation of the estimator task specified by pubs
.
This function uses qiskit-aer
’s Estimator
class to simulate the estimation task classically.
To ensure scalability, every circuit in pubs
is required to be a Clifford circuit, so that it can be simulated efficiently regardless of its size. For estimation tasks that involve non-Clifford circuits, the recommended workflow consists of mapping the non-Clifford circuits to the nearest Clifford circuits using the ConvertISAToClifford
transpiler pass, or equivalently, to use the Neat’s to_clifford()
convenience method. Alternatively, setting cliffordize
to True
ensures that the to_clifford()
method is applied automatically to the given pubs
prior to the simulation.
Parameters
- pubs (
Sequence
[Union
[EstimatorPub
,Tuple
[QuantumCircuit
,Union
[str
,Pauli
,SparsePauliOp
,Mapping
[Union
[str
,Pauli
],float
],_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]],Tuple
[QuantumCircuit
,Union
[str
,Pauli
,SparsePauliOp
,Mapping
[Union
[str
,Pauli
],float
],_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]],Mapping
[Union
[Parameter
,str
,Tuple
[Union
[Parameter
,str
],...
]],Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]]],Tuple
[QuantumCircuit
,Union
[str
,Pauli
,SparsePauliOp
,Mapping
[Union
[str
,Pauli
],float
],_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]],Mapping
[Union
[Parameter
,str
,Tuple
[Union
[Parameter
,str
],...
]],Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]],Real
]]]) – The PUBs specifying the estimation task of interest. - cliffordize (
bool
) – Whether or not to automatically apply theConvertISAToClifford
transpiler pass to the givenpubs
before performing the simulations. - seed_simulator (
Optional
[int
]) – A seed for the simulator. - precision (
float
) – The target precision for the estimates of each expectation value in the returned results.
Return type
Returns
The results of the simulation.
noisy_sim
noisy_sim(pubs, cliffordize=False, seed_simulator=None, precision=0)
Perform a noisy simulation of the estimator task specified by pubs
.
This function uses qiskit-aer
’s Estimator
class to simulate the estimation task classically.
To ensure scalability, every circuit in pubs
is required to be a Clifford circuit, so that it can be simulated efficiently regardless of its size. For estimation tasks that involve non-Clifford circuits, the recommended workflow consists of mapping the non-Clifford circuits to the nearest Clifford circuits using the ConvertISAToClifford
transpiler pass, or equivalently, to use the Neat’s to_clifford()
convenience method. Alternatively, setting cliffordize
to True
ensures that the to_clifford()
method is applied automatically to the given pubs
prior to the simulation.
Parameters
- pubs (
Sequence
[Union
[EstimatorPub
,Tuple
[QuantumCircuit
,Union
[str
,Pauli
,SparsePauliOp
,Mapping
[Union
[str
,Pauli
],float
],_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]],Tuple
[QuantumCircuit
,Union
[str
,Pauli
,SparsePauliOp
,Mapping
[Union
[str
,Pauli
],float
],_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]],Mapping
[Union
[Parameter
,str
,Tuple
[Union
[Parameter
,str
],...
]],Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]]],Tuple
[QuantumCircuit
,Union
[str
,Pauli
,SparsePauliOp
,Mapping
[Union
[str
,Pauli
],float
],_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]],Mapping
[Union
[Parameter
,str
,Tuple
[Union
[Parameter
,str
],...
]],Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]],Real
]]]) – The PUBs specifying the estimation task of interest. - cliffordize (
bool
) – Whether or not to automatically apply theConvertISAToClifford
transpiler pass to the givenpubs
before performing the simulations. - seed_simulator (
Optional
[int
]) – A seed for the simulator. - precision (
float
) – The target precision for the estimates of each expectation value in the returned results.
Return type
Returns
The results of the simulation.
to_clifford
to_clifford(pubs)
Return the cliffordized version of the given pubs
.
This convenience method runs the ConvertISAToClifford
transpiler pass on the PUBs’ circuits.
Parameters
pubs (Sequence
[Union
[EstimatorPub
, Tuple
[QuantumCircuit
, Union
[str
, Pauli
, SparsePauliOp
, Mapping
[Union
[str
, Pauli
], float
], _SupportsArray
[dtype
[Any
]], _NestedSequence
[_SupportsArray
[dtype
[Any
]]], bool
, int
, float
, complex
, bytes
, _NestedSequence
[Union
[bool
, int
, float
, complex
, str
, bytes
]]]], Tuple
[QuantumCircuit
, Union
[str
, Pauli
, SparsePauliOp
, Mapping
[Union
[str
, Pauli
], float
], _SupportsArray
[dtype
[Any
]], _NestedSequence
[_SupportsArray
[dtype
[Any
]]], bool
, int
, float
, complex
, bytes
, _NestedSequence
[Union
[bool
, int
, float
, complex
, str
, bytes
]]], Mapping
[Union
[Parameter
, str
, Tuple
[Union
[Parameter
, str
], ...
]], Union
[_SupportsArray
[dtype
[Any
]], _NestedSequence
[_SupportsArray
[dtype
[Any
]]], bool
, int
, float
, complex
, str
, bytes
, _NestedSequence
[Union
[bool
, int
, float
, complex
, str
, bytes
]]]]], Tuple
[QuantumCircuit
, Union
[str
, Pauli
, SparsePauliOp
, Mapping
[Union
[str
, Pauli
], float
], _SupportsArray
[dtype
[Any
]], _NestedSequence
[_SupportsArray
[dtype
[Any
]]], bool
, int
, float
, complex
, bytes
, _NestedSequence
[Union
[bool
, int
, float
, complex
, str
, bytes
]]], Mapping
[Union
[Parameter
, str
, Tuple
[Union
[Parameter
, str
], ...
]], Union
[_SupportsArray
[dtype
[Any
]], _NestedSequence
[_SupportsArray
[dtype
[Any
]]], bool
, int
, float
, complex
, str
, bytes
, _NestedSequence
[Union
[bool
, int
, float
, complex
, str
, bytes
]]]], Real
]]]) – The PUBs to turn into Clifford PUBs.
Return type
list
[EstimatorPub
]
Returns
The Clifford PUBs.