qml.resource.mul_in_series¶
- mul_in_series(resources, scalar)[source]¶
Multiply the
Resources
object by a scalar as if the circuit was repeated that many times in series.The repeated copies of
resources
are assumed to act on the same wires asresources
. The resulting circuit depth is the depth ofresources
multiplied byscalar
. To multiply as if the circuit was repeated in parallel seemul_in_parallel()
.- Parameters
- Returns
the combined resources
- Return type
Usage Details
Example
First we build a
Resources
object.from pennylane.measurements import Shots from pennylane.resource import Resources resources = Resources( num_wires = 2, num_gates = 2, gate_types = {"Hadamard": 1, "CNOT": 1}, gate_sizes = {1: 1, 2: 1}, depth = 2, shots = Shots(10) )
Now we print the product.
>>> print(qml.resource.mul_in_series(resources, 2)) wires: 2 gates: 4 depth: 4 shots: Shots(total=20) gate_types: {'Hadamard': 2, 'CNOT': 2} gate_sizes: {1: 2, 2: 2}
code/api/pennylane.resource.mul_in_series
Download Python script
Download Notebook
View on GitHub