Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

PolynomialRotation

PolynomialRotation(px, num_state_qubits, basis='Y') GitHub(opens in a new tab)

DEPRECATED. Polynomial rotation.

Deprecated since version 0.7.0

Use Terra’s qiskit.circuit.library.PolynomialPauliRotations instead.

For a polynomial p(x), a basis state |i> and a target qubit |0> this operator acts as:

|i>|0> –> |i>( cos(p(i))|0> + sin(p(i))|1> )

Let n be the number of qubits representing the state, d the degree of p(x) and q_i the qubits,

where q_0 is the least significant qubit. Then for

x = sum_{i=0}^{n-1} 2^{i}*q_i,

we can write

p(x) = sum_{j=0}^{j=d} px[j]*(q_0 + 2*q_1 + … + 2^{n-1}*q_n-1)^{j}.

The expression above is used to obtain the list of controls and rotation angles for the circuit.

Prepare an approximation to a state with amplitudes specified by a polynomial.

Parameters

  • px (list) – coefficients of the polynomial, px[i] is the coefficient of x^i
  • num_state_qubits (int) – number of qubits representing the state
  • basis (str) – type of Pauli rotation (‘X’, ‘Y’, ‘Z’)

Raises

ValueError – invalid input


Attributes

num_target_qubits

Returns the number of target qubits


Methods

build

PolynomialRotation.build(qc, q, q_target, q_ancillas=None, reverse=0)

Build the circuit.

Parameters

  • qc (QuantumCircuit) – quantum circuit
  • q (list) – list of qubits (has to be same length as self.num_state_qubits)
  • q_target (Qubit) – qubit to be rotated. The algorithm is successful when this qubit is in the |1> state
  • q_ancillas (list) – list of ancilla qubits (or None if none needed)
  • reverse (int) – if 1, apply with reversed list of qubits (i.e. q_n as q_0, q_n-1 as q_1, etc).

build_controlled

PolynomialRotation.build_controlled(qc, q, q_control, q_ancillas=None, use_basis_gates=True)

Adds corresponding controlled sub-circuit to given circuit

Parameters

  • qc (QuantumCircuit) – quantum circuit
  • q (list) – list of qubits (has to be same length as self._num_qubits)
  • q_control (Qubit) – control qubit
  • q_ancillas (list) – list of ancilla qubits (or None if none needed)
  • use_basis_gates (bool) – use basis gates for expansion of controlled circuit

build_controlled_inverse

PolynomialRotation.build_controlled_inverse(qc, q, q_control, q_ancillas=None, use_basis_gates=True)

Adds controlled inverse of corresponding sub-circuit to given circuit

Parameters

  • qc (QuantumCircuit) – quantum circuit
  • q (list) – list of qubits (has to be same length as self._num_qubits)
  • q_control (Qubit) – control qubit
  • q_ancillas (list) – list of ancilla qubits (or None if none needed)
  • use_basis_gates (bool) – use basis gates for expansion of controlled circuit

build_controlled_inverse_power

PolynomialRotation.build_controlled_inverse_power(qc, q, q_control, power, q_ancillas=None, use_basis_gates=True)

Adds controlled, inverse, power of corresponding circuit. May be overridden if a more efficient implementation is possible

build_controlled_power

PolynomialRotation.build_controlled_power(qc, q, q_control, power, q_ancillas=None, use_basis_gates=True)

Adds controlled power of corresponding circuit. May be overridden if a more efficient implementation is possible

build_inverse

PolynomialRotation.build_inverse(qc, q, q_ancillas=None)

Adds inverse of corresponding sub-circuit to given circuit

Parameters

  • qc (QuantumCircuit) – quantum circuit
  • q (list) – list of qubits (has to be same length as self._num_qubits)
  • q_ancillas (list) – list of ancilla qubits (or None if none needed)

build_inverse_power

PolynomialRotation.build_inverse_power(qc, q, power, q_ancillas=None)

Adds inverse power of corresponding circuit. May be overridden if a more efficient implementation is possible

build_power

PolynomialRotation.build_power(qc, q, power, q_ancillas=None)

Adds power of corresponding circuit. May be overridden if a more efficient implementation is possible

get_num_qubits

PolynomialRotation.get_num_qubits()

returns number of qubits

get_num_qubits_controlled

PolynomialRotation.get_num_qubits_controlled()

returns number of qubits controlled

required_ancillas

PolynomialRotation.required_ancillas()

returns required ancillas

required_ancillas_controlled

PolynomialRotation.required_ancillas_controlled()

returns required ancillas controlled

Was this page helpful?