SHadamard#

class torchquantum.operator.SHadamard(has_params: bool = False, trainable: bool = False, init_params=None, n_wires=None, wires=None, inverse=False)[source]#

Bases: Operation

Class for SHadamard Gate.

__init__(has_params: bool = False, trainable: bool = False, init_params=None, n_wires=None, wires=None, inverse=False)#

_summary_

Parameters:
  • has_params (bool, optional) – Whether the operations has parameters. Defaults to False.

  • trainable (bool, optional) – Whether the parameters are trainable (if contains parameters). Defaults to False.

  • init_params (torch.Tensor, optional) – Initial parameters. Defaults to None.

  • n_wires (int, optional) – Number of qubits. Defaults to None.

  • wires (Union[int, List[int]], optional) – Which qubit the operation is applied to. Defaults to None.

Methods

static func(q_device, wires, params=None, n_wires=None, static=False, parent_graph=None, inverse=False, comp_method='bmm')#

Perform the shadamard gate.

Parameters:
  • q_device (tq.QuantumDevice) – The QuantumDevice.

  • wires (Union[List[int], int]) – Which qubit(s) to apply the gate.

  • params (torch.Tensor, optional) – Parameters (if any) of the gate. Default to None.

  • n_wires (int, optional) – Number of qubits the gate is applied to. Default to None.

  • static (bool, optional) – Whether use static mode computation. Default to False.

  • parent_graph (tq.QuantumGraph, optional) – Parent QuantumGraph of current operation. Default to None.

  • inverse (bool, optional) – Whether inverse the gate. Default to False.

  • comp_method (bool, optional) – Use ‘bmm’ or ‘einsum’ method to perform

  • 'bmm'. (matrix vector multiplication. Default to) –

Returns:

None.

Attributes

matrix = tensor([[ 0.9239+0.j, -0.3827+0.j],         [ 0.3827+0.j,  0.9239+0.j]])#
num_params = 0#
num_wires = 1#
op_name = 'shadamard'#
training: bool#