quri_parts.tensornetwork.sampler module¶
- tensor_network_state_probabilities(circuit)¶
Returns the probabilities of the state.
- Parameters:
circuit (ImmutableQuantumCircuit)
- Return type:
ndarray[Any, dtype[float64]]
- tensor_network_ideal_sample(circuit, shots)¶
Returns the probabilities multiplied by the specific shot count.
- Parameters:
circuit (ImmutableQuantumCircuit)
shots (int)
- Return type:
core.sampling.MeasurementCounts
- tensor_network_sample(circuit, shots, seed=None)¶
Returns the probabilities multiplied by the specific shot count.
- Parameters:
circuit (ImmutableQuantumCircuit)
shots (int)
seed (int | None)
- Return type:
core.sampling.MeasurementCounts
- create_tensornetwork_ideal_sampler()¶
Returns a
Samplerthat uses TensorNetwork simulator for returning the probabilities multiplied by the specific shot count.- Return type:
core.sampling.Sampler
- create_tensornetwork_sampler(seed=None)¶
Returns a
Samplerthat uses TensorNetwork simulator for returning the samples from a probability distribution.- Parameters:
seed (int | None)
- Return type:
core.sampling.Sampler
- create_tensornetwork_state_sampler(seed=None)¶
Returns a
Samplerthat uses TensorNetwork simulator for returning the samples from a probability distribution.- Parameters:
seed (Optional[int])
- Return type:
StateSampler[QuantumStateT]
- sample_concurrently(circuit_shots_tuples, executor, concurrency=1, seed=None)¶
- Parameters:
circuit_shots_tuples (Iterable[tuple[ImmutableQuantumCircuit, int]])
executor (Optional['Executor'])
concurrency (int)
seed (Optional[int])
- Return type:
Iterable[MeasurementCounts]
- create_tensornetwork_concurrent_sampler(executor=None, concurrency=1, seed=None)¶
Returns a
ConcurrentSamplerthat uses TensorNetwork simulator for sampling.For now, this function works when the executor is defined like below
Examples
>>> with ProcessPoolExecutor( max_workers=2, mp_context=get_context("spawn") ) as executor: sampler = create_tensornetwork_concurrent_sampler( executor, 2 ) results = list(sampler([(circuit1, 1000), (circuit2, 2000)]))
- Parameters:
executor (Optional['Executor'])
concurrency (int)
seed (Optional[int])
- Return type:
ConcurrentSampler
- create_tensornetwork_general_sampler(seed=None)¶
- Parameters:
seed (int | None)
- Return type: