HamiltonianGate

class HamiltonianGate(data, time, label=None)[source]

Class for representing evolution by a Hermitian Hamiltonian operator as a gate. This gate resolves to a UnitaryGate U(t) = exp(-1j * t * H), which can be decomposed into basis gates if it is 2 qubits or less, or simulated directly in Aer for more qubits.

Create a gate from a hamiltonian operator and evolution time parameter t

Parameters
  • data (matrix or Operator) – a hermitian operator.

  • time (float) – time evolution parameter.

  • label (str) – unitary name for backend [Default: None].

Raises

ExtensionError – if input data is not an N-qubit unitary operator.

Attributes

HamiltonianGate.decompositions

Get the decompositions of the instruction from the SessionEquivalenceLibrary.

HamiltonianGate.definition

Return definition in terms of other basic gates.

HamiltonianGate.label

Return gate label

HamiltonianGate.params

return instruction params.

Methods

HamiltonianGate.add_decomposition(decomposition)

Add a decomposition of the instruction to the SessionEquivalenceLibrary.

HamiltonianGate.adjoint()

Return the adjoint of the unitary.

HamiltonianGate.assemble()

Assemble a QasmQobjInstruction

HamiltonianGate.broadcast_arguments(qargs, cargs)

Validation and handling of the arguments and its relationship.

HamiltonianGate.c_if(classical, val)

Add classical condition on register classical and value val.

HamiltonianGate.conjugate()

Return the conjugate of the Hamiltonian.

HamiltonianGate.control([num_ctrl_qubits, …])

Return controlled version of gate.

HamiltonianGate.copy([name])

Copy of the instruction.

HamiltonianGate.inverse()

Return the adjoint of the unitary.

HamiltonianGate.is_parameterized()

Return True .IFF.

HamiltonianGate.mirror()

For a composite instruction, reverse the order of sub-gates.

HamiltonianGate.power(exponent)

Creates a unitary gate as gate^exponent.

HamiltonianGate.qasm()

Raise an error, as QASM is not defined for the HamiltonianGate.

HamiltonianGate.repeat(n)

Creates an instruction with gate repeated n amount of times.

HamiltonianGate.to_matrix()

Return matrix for the unitary.

HamiltonianGate.transpose()

Return the transpose of the Hamiltonian.