qml.H¶
- H¶
H(wires) The Hadamard operator
\[\begin{split}H = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1\\ 1 & -1\end{bmatrix}.\end{split}\]See also
The equivalent long-form alias
Hadamard
Details:
Number of wires: 1
Number of parameters: 0
- Parameters
wires (Sequence[int] or int) – the wire the operation acts on
Attributes
arithmetic_depth
Arithmetic depth of the operator.
basis
The basis of an operation, or for controlled gates, of the target operation.
batch_size
Batch size of the operator if it is used with broadcasted parameters.
control_wires
Control wires of the operator.
grad_method
Gradient computation method.
grad_recipe
Gradient recipe for the parameter-shift method.
has_adjoint
has_decomposition
has_diagonalizing_gates
has_generator
has_matrix
has_sparse_matrix
hash
Integer hash that uniquely represents the operator.
hyperparameters
Dictionary of non-trainable variables that this operation depends on.
id
Custom string to label a specific operator instance.
is_hermitian
All observables must be hermitian
name
String for the name of the operator.
ndim_params
Number of dimensions per trainable parameter of the operator.
num_params
Number of trainable parameters that the operator depends on.
num_wires
Number of wires that the operator acts on.
parameter_frequencies
Returns the frequencies for each operator parameter with respect to an expectation value of the form \(\langle \psi | U(\mathbf{p})^\dagger \hat{O} U(\mathbf{p})|\psi\rangle\).
parameters
Trainable parameters that the operator depends on.
pauli_rep
A
PauliSentence
representation of the Operator, orNone
if it doesn't have one.wires
Wires that the operator acts on.
Methods
adjoint
()Create an operation that is the adjoint of this one.
compare
(other)Compares with another
Hamiltonian
,Tensor
, orObservable
, to determine if they are equivalent.compute_decomposition
(wires)Representation of the operator as a product of other operators (static method).
compute_diagonalizing_gates
(wires)Sequence of gates that diagonalize the operator in the computational basis (static method).
compute_eigvals
()Eigenvalues of the operator in the computational basis (static method).
compute_matrix
()Representation of the operator as a canonical matrix in the computational basis (static method).
compute_sparse_matrix
()Representation of the operator as a sparse matrix in the computational basis (static method).
decomposition
()Representation of the operator as a product of other operators.
diagonalizing_gates
()Sequence of gates that diagonalize the operator in the computational basis.
eigvals
()Eigenvalues of the operator in the computational basis.
generator
()Generator of an operator that is in single-parameter-form.
label
([decimals, base_label, cache])A customizable string representation of the operator.
map_wires
(wire_map)Returns a copy of the current operator with its wires changed according to the given wire map.
matrix
([wire_order])Representation of the operator as a matrix in the computational basis.
pow
(z)A list of new operators equal to this one raised to the given power.
queue
([context])Append the operator to the Operator queue.
simplify
()Reduce the depth of nested operators to the minimum.
single_qubit_rot_angles
()The parameters required to implement a single-qubit gate as an equivalent
Rot
gate, up to a global phase.sparse_matrix
([wire_order])Representation of the operator as a sparse matrix in the computational basis.
terms
()Representation of the operator as a linear combination of other operators.