qxmt.feature_maps.pennylane.rotation module

qxmt.feature_maps.pennylane.rotation module#

class qxmt.feature_maps.pennylane.rotation.HRotationFeatureMap(n_qubits, reps, rotation_axis)

Bases: BaseFeatureMap

Hadamard and multi-axis rotation feature map class.

Parameters:
  • BaseFeatureMap (_type_) – base feature map class

  • n_qubits (int)

  • reps (int)

  • rotation_axis (list[str])

Example

>>> import numpy as np
>>> from qxmt.feature_maps.pennylane.rotation import HRotationFeatureMap
>>> feature_map = HRotationFeatureMap(2, 2, ["X", "Y"])
>>> feature_map.draw(x_dim=2)
0: ──H─╭AngleEmbedding(M0)─╭AngleEmbedding(M0)──H─╭AngleEmbedding(M0)─╭AngleEmbedding(M0)─┤
1: ──H─╰AngleEmbedding(M0)─╰AngleEmbedding(M0)──H─╰AngleEmbedding(M0)─╰AngleEmbedding(M0)─┤
M0 = [0.88859928 0.32907378]
__init__(n_qubits, reps, rotation_axis)

Initialize the Hadamard and multi axis rotation feature map class.

Parameters:
  • n_qubits (int) – number of qubits

  • reps (int) – number of repetitions

  • rotation_axis (list[str]) – list of rotation axis

Return type:

None

feature_map(x)

Create quantum circuit of Hadamard and rotation feature map.

Parameters:

x (np.ndarray) – input data

Return type:

None

class qxmt.feature_maps.pennylane.rotation.RotationFeatureMap(n_qubits, reps, rotation_axis)

Bases: BaseFeatureMap

Multi-axis rotation feature map class.

Parameters:
  • BaseFeatureMap (_type_) – base feature map class

  • n_qubits (int)

  • reps (int)

  • rotation_axis (list[str])

Example

>>> import numpy as np
>>> from qxmt.feature_maps.pennylane.rotation import RotationFeatureMap
>>> feature_map = RotationFeatureMap(2, 2, ["X", "Y"])
>>> feature_map.draw(x_dim=2)
0: ─╭AngleEmbedding(M0)─╭AngleEmbedding(M0)─╭AngleEmbedding(M0)─╭AngleEmbedding(M0)─┤
1: ─╰AngleEmbedding(M0)─╰AngleEmbedding(M0)─╰AngleEmbedding(M0)─╰AngleEmbedding(M0)─┤
M0 = [0.87336112 0.05976227]
__init__(n_qubits, reps, rotation_axis)

Initialize the multi axis rotation feature map class.

Parameters:
  • n_qubits (int) – number of qubits

  • reps (int) – number of repetitions

  • rotation_axis (list[str]) – list of rotation axis

Return type:

None

feature_map(x)

Create quantum circuit of rotation feature map.

Parameters:

x (np.ndarray) – input data

Return type:

None