qml.resource.mul_in_parallel

mul_in_parallel(resources, scalar)[source]

Multiply the Resources object by a scalar as if the circuit was repeated that many times in parallel.

The repeated copies of resources are assumed to act on disjoint qubits. The resulting circuit depth is equal to the depth of resources. To multiply as if the repeated copies were executed in series see mul_in_series().

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_parallel(resources, 2))
wires: 4
gates: 4
depth: 2
shots: Shots(total=20)
gate_types:
{'Hadamard': 2, 'CNOT': 2}
gate_sizes:
{1: 2, 2: 2}