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 as resources. The resulting circuit depth is the depth of resources multiplied by scalar. To multiply as if the circuit was repeated in parallel see mul_in_parallel().

Parameters
Returns

the combined resources

Return type

Resources

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}