qml.estimator.templates.IQP

class IQP(num_wires, pattern, spin_sym=False, wires=None)[source]

Bases: ResourceOperator

Resource class for the Instantaneous Quantum Polynomial (IQP) template.

Parameters:
  • num_wires (int) – the number of qubits the operation acts upon

  • pattern (list[list[list[int]]]) – Specification of the trainable gates. Each element of gates corresponds to a unique trainable parameter. Each sublist specifies the generators to which that parameter applies. Generators are specified by listing the qubits on which an X operator acts.

  • spin_sym (bool, optional) – If True, the circuit is equivalent to one where the initial state \(\frac{1}{\sqrt(2)}(|00\dots0> + |11\dots1>)\) is used in place of \(|00\dots0>\).

  • wires (Sequence[int], optional) – the wires the operation acts on

Example:

The resources for this operation are computed using:

>>> import pennylane.estimator as qre
>>> iqp = qre.IQP(num_wires=4, pattern=[[[0]], [[1]], [[2]], [[3]]])
>>> print(qre.estimate(iqp))
--- Resources: ---
 Total wires: 4
   algorithmic wires: 4
   allocated wires: 0
     zero state: 0
     any state: 0
 Total gates : 184
   'T': 176,
   'CNOT': 0,
   'Hadamard': 8

See also

IQP

resource_keys

resource_params

Returns a dictionary containing the minimal information needed to compute the resources.

resource_keys = {'num_wires', 'pattern', 'spin_sym'}
resource_params

Returns a dictionary containing the minimal information needed to compute the resources.

Returns:

A dictionary containing the resource parameters:
  • num_wires (int): the number of qubits the operation acts upon

Return type:

dict

resource_decomp(num_wires, pattern, spin_sym)

Returns a list representing the resources of the operator.

resource_rep(num_wires, pattern, spin_sym)

Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.

tracking_name(num_wires, pattern, spin_sym)

Returns the tracking name built with the operator's parameters.

classmethod resource_decomp(num_wires, pattern, spin_sym)[source]

Returns a list representing the resources of the operator. Each object in the list represents a gate and the number of times it occurs in the circuit.

Parameters:
  • num_wires (int) – the number of qubits the operation acts upon

  • pattern (list[list[list[int]]]) – Specification of the trainable gates. Each element of gates corresponds to a unique trainable parameter. Each sublist specifies the generators to which that parameter applies. Generators are specified by listing the qubits on which an X operator acts.

  • spin_sym (bool, optional) – If True, the circuit is equivalent to one where the initial state \(\frac{1}{\sqrt(2)}(|00\dots0> + |11\dots1>)\) is used in place of \(|00\dots0>\).

Returns:

A list of GateCount objects, where each object represents a specific quantum gate and the number of times it appears in the decomposition.

Return type:

list[GateCount]

classmethod resource_rep(num_wires, pattern, spin_sym)[source]

Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.

Parameters:
  • num_wires (int) – the number of qubits the operation acts upon

  • pattern (list[list[list[int]]]) – Specification of the trainable gates. Each element of gates corresponds to a unique trainable parameter. Each sublist specifies the generators to which that parameter applies. Generators are specified by listing the qubits on which an X operator acts.

  • spin_sym (bool, optional) – If True, the circuit is equivalent to one where the initial state \(\frac{1}{\sqrt(2)}(|00\dots0> + |11\dots1>)\) is used in place of \(|00\dots0>\).

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

static tracking_name(num_wires, pattern, spin_sym)[source]

Returns the tracking name built with the operator’s parameters.

Contents

Using PennyLane

Release news

Development

API

Internals