qml

This is the top level module from which all basic functions and classes of PennyLane can be directly imported.

Functions

about()

Prints the information for pennylane installation.

adjoint(fn[, lazy])

Create the adjoint of an Operator or a function that applies the adjoint of the provided function.

adjoint_metric_tensor(tape)

Implements the adjoint method outlined in Jones to compute the metric tensor.

apply(op[, context])

Apply an instantiated operator or measurement to a queuing context.

apply_controlled_Q(tape, wires, target_wire, …)

Applies the transform that performs a controlled version of the \(\mathcal{Q}\) unitary defined in this paper.

batch_input(tape, argnum)

Transform a circuit to support an initial batch dimension for gate inputs.

batch_params(tape[, all_operations])

Transform a QNode to support an initial batch dimension for operation parameters.

batch_partial(qnode[, all_operations, …])

Create a batched partial callable object from the QNode specified.

bravyi_kitaev(fermi_operator, n[, ps, …])

Convert a fermionic operator to a qubit operator using the Bravyi-Kitaev mapping.

broadcast(unitary, wires, pattern[, …])

Applies a unitary multiple times to a specific pattern of wires.

center(g[, pauli])

A function to compute the center of a Lie algebra.

classical_shadow(wires[, seed])

The classical shadow measurement protocol.

clifford_t_decomposition(tape[, epsilon, …])

Decomposes a circuit into the Clifford+T basis.

comm(op1, op2[, pauli])

Compute commutator between two operators in PennyLane

commutation_dag(tape)

Construct the pairwise-commutation DAG (directed acyclic graph) representation of a quantum circuit.

commutator(op1, op2[, pauli])

Compute commutator between two operators in PennyLane

compile(tape[, pipeline, basis_set, …])

Compile a circuit by applying a series of transforms to a quantum function.

cond(condition, true_fn[, false_fn, elifs])

Quantum-compatible if-else conditionals — condition quantum operations on parameters such as the results of mid-circuit qubit measurements.

counts([op, wires, all_outcomes])

Sample from the supplied observable, with the number of shots determined from the dev.shots attribute of the corresponding device, returning the number of counts for each sample.

ctrl(op, control[, control_values, work_wires])

Create a method that applies a controlled version of the provided op.

cut_circuit(tape[, auto_cutter, …])

Cut up a quantum circuit into smaller circuit fragments.

cut_circuit_mc(tape[, …])

Cut up a circuit containing sample measurements into smaller fragments using a Monte Carlo method.

defer_measurements(tape, **kwargs)

Quantum function transform that substitutes operations conditioned on measurement outcomes to controlled operations.

density_matrix(wires)

Quantum density matrix in the computational basis.

device(name, *args, **kwargs)

Load a device and return the instance.

dot(coeffs, ops[, pauli, grouping_type, method])

Returns the dot product between the coeffs vector and the ops list of operators.

draw(qnode[, wire_order, show_all_wires, …])

Create a function that draws the given qnode or quantum function.

draw_mpl(qnode[, wire_order, …])

Draw a qnode with matplotlib

dynamic_one_shot(tape)

Transform a QNode to into several one-shot tapes to support dynamic circuit execution.

eigvals(op[, k, which])

The eigenvalues of one or more operations.

equal(op1, op2[, check_interface, …])

Function for determining operator or measurement equality.

evolve()

This method is dispatched and its functionality depends on the type of the input op.

execute(tapes, device[, gradient_fn, …])

New function to execute a batch of tapes on a device in an autodifferentiable-compatible manner.

exp(op[, coeff, num_steps, id])

Take the exponential of an Operator times a coefficient.

expval(op)

Expectation value of the supplied observable.

for_loop(lower_bound, upper_bound, step)

A qjit() compatible for-loop for PennyLane programs.

from_pyquil(pyquil_program)

Loads pyQuil Program objects by using the converter in the PennyLane-Rigetti plugin.

from_qasm(quantum_circuit)

Loads quantum circuits from a QASM string using the converter in the PennyLane-Qiskit plugin.

from_qasm_file(qasm_filename)

Loads quantum circuits from a QASM file using the converter in the PennyLane-Qiskit plugin.

from_qiskit(quantum_circuit[, measurements])

Converts a Qiskit QuantumCircuit into a PennyLane quantum function.

from_qiskit_op(qiskit_op[, params, wires])

Converts a Qiskit SparsePauliOp into a PennyLane Operator.

from_quil(quil)

Loads quantum circuits from a Quil string using the converter in the PennyLane-Rigetti plugin.

from_quil_file(quil_filename)

Loads quantum circuits from a Quil file using the converter in the PennyLane-Rigetti plugin.

generator(op[, format])

Returns the generator of an operation.

import_operator(qubit_observable[, format, …])

Convert an external operator to a PennyLane operator.

is_commuting(operation1, operation2[, wire_map])

Check if two operations are commuting using a lookup table.

is_hermitian(op)

Check if the operation is hermitian.

is_unitary(op)

Check if the operation is unitary.

iterative_qpe(base, ancilla, iters)

Performs the iterative quantum phase estimation circuit.

jacobian(func[, argnum, method, h])

Returns the Jacobian as a callable function of vector-valued (functions of) QNodes.

jordan_wigner(fermi_operator[, ps, …])

Convert a fermionic operator to a qubit operator using the Jordan-Wigner mapping.

jvp(f, params, tangents[, method, h, argnum])

A qjit() compatible Jacobian-vector product of PennyLane programs.

layer(template, depth, *args, **kwargs)

Repeatedly applies a unitary a given number of times.

lie_closure(generators[, max_iterations, …])

Compute the dynamical Lie algebra from a set of generators.

load(quantum_circuit_object, format, …)

Load external quantum assembly and quantum circuits from supported frameworks into PennyLane templates.

map_wires(input, wire_map[, queue, replace])

Changes the wires of an operator, tape, qnode or quantum function according to the given wire map.

matrix(op[, wire_order])

The matrix representation of an operation or quantum circuit.

measure(wires[, reset, postselect])

Perform a mid-circuit measurement in the computational basis on the supplied qubit.

metric_tensor(tape[, argnum, approx, …])

Returns a function that computes the metric tensor of a given QNode or quantum tape.

mutual_info(wires0, wires1[, log_base])

Mutual information between the subsystems prior to measurement:

parity_transform(fermi_operator, n[, ps, …])

Convert a fermionic operator to a qubit operator using the parity mapping.

pattern_matching(circuit_dag, pattern_dag)

Function that applies the pattern matching algorithm and returns the list of maximal matches.

pattern_matching_optimization(tape, …[, …])

Quantum function transform to optimize a circuit given a list of patterns (templates).

pauli_decompose(H[, hide_identity, …])

Decomposes a Hermitian matrix into a linear combination of Pauli operators.

paulix_ops(generators, num_qubits)

Generate the single qubit Pauli-X operators \(\sigma^{x}_{i}\) for each symmetry \(\tau_j\), such that it anti-commutes with \(\tau_j\) and commutes with all others symmetries \(\tau_{k\neq j}\).

pow(base[, z, lazy, id])

Raise an Operator to a power.

probs([wires, op])

Probability of each computational basis state.

prod(*ops[, id, lazy])

Construct an operator which represents the generalized product of the operators provided.

purity(wires)

The purity of the system prior to measurement.

qjit([fn, compiler])

A decorator for just-in-time compilation of hybrid quantum programs in PennyLane.

qnode(func, device[, interface, …])

Represents a quantum node in the hybrid computational graph.

qsvt(A, angles, wires[, convention])

Implements the quantum singular value transformation (QSVT) circuit.

quantum_monte_carlo(tape, wires, …)

Applies the transform quantum Monte Carlo estimation algorithm.

refresh_devices()

Scan installed PennyLane plugins to refresh the device list.

s_prod(scalar, operator[, lazy, id])

Construct an operator which is the scalar product of the given scalar and operator provided.

sample([op, wires])

Sample from the supplied observable, with the number of shots determined from the dev.shots attribute of the corresponding device, returning raw samples.

shadow_expval(H[, k, seed])

Compute expectation values using classical shadows in a differentiable manner.

simplify(input)

Simplifies an operator, tape, qnode or quantum function by reducing its arithmetic depth or number of rotation parameters.

snapshots(qnode)

Create a function that retrieves snapshot results from a QNode.

specs(qnode[, max_expansion, expansion_strategy])

Resource information about a quantum circuit.

state()

Quantum state in the computational basis.

structure_constants(g[, pauli])

Compute the structure constants that make up the adjoint representation of a Lie algebra.

sum(*summands[, grouping_type, method, id, lazy])

Construct an operator which is the sum of the given operators.

symmetry_generators(h)

Compute the generators \(\{\tau_1, \ldots, \tau_k\}\) for a Hamiltonian over the binary field \(\mathbb{Z}_2\).

taper(h, generators, paulixops, paulix_sector)

Transform a Hamiltonian with a Clifford operator and then taper qubits.

taper_operation(operation, generators, …)

Transform a gate operation with a Clifford operator and then taper qubits.

transform(quantum_transform[, …])

Generalizes a function that transforms tapes to work with additional circuit-like objects such as a QNode.

var(op)

Variance of the supplied observable.

version()

Returns the PennyLane version number.

vjp(f, params, cotangents[, method, h, argnum])

A qjit() compatible Vector-Jacobian product of PennyLane programs.

vn_entropy(wires[, log_base])

Von Neumann entropy of the system prior to measurement.

while_loop(cond_fn)

A qjit() compatible while-loop for PennyLane programs.

Classes

AQFT(order, wires)

Apply an approximate quantum Fourier transform (AQFT).

AdagradOptimizer([stepsize, eps])

Gradient-descent optimizer with past-gradient-dependent learning rate in each dimension.

AdamOptimizer([stepsize, beta1, beta2, eps])

Gradient-descent optimizer with adaptive learning rate, first and second moment.

AdaptiveOptimizer([param_steps, stepsize])

Optimizer for building fully trained quantum circuits by adding gates adaptively.

AllSinglesDoubles(weights, wires, hf_state)

Builds a quantum circuit to prepare correlated states of molecules by applying all SingleExcitation and DoubleExcitation operations to the initial Hartree-Fock state.

AmplitudeAmplification(U, O[, iters, …])

Applies amplitude amplification.

AmplitudeDamping(gamma, wires[, id])

Single-qubit amplitude damping error channel.

AmplitudeEmbedding(features, wires[, …])

Encodes \(2^n\) features into the amplitude vector of \(n\) qubits.

AngleEmbedding(features, wires[, rotation, id])

Encodes \(N\) features into the rotation angles of \(n\) qubits, where \(N \leq n\).

ApproxTimeEvolution(hamiltonian, time, n[, id])

Applies the Trotterized time-evolution operator for an arbitrary Hamiltonian, expressed in terms of Pauli gates.

ArbitraryStatePreparation(weights, wires[, id])

Implements an arbitrary state preparation on the specified wires.

ArbitraryUnitary(weights, wires[, id])

Implements an arbitrary unitary on the specified wires.

Barrier(wires)

The Barrier operator, used to separate the compilation process into blocks or as a visual tool.

BasicEntanglerLayers(weights[, wires, …])

Layers consisting of one-parameter single-qubit rotations on each qubit, followed by a closed chain or ring of CNOT gates.

BasisEmbedding(features, wires[, id])

Encodes \(n\) binary features into a basis state of \(n\) qubits.

BasisRotation(wires, unitary_matrix[, check, id])

Implement a circuit that provides a unitary that can be used to do an exact single-body basis rotation.

BasisState(n, wires)

Prepares a single computational basis state.

BasisStatePreparation(basis_state, wires[, id])

Prepares a basis state on the given wires using a sequence of Pauli-X gates.

Beamsplitter(theta, phi, wires[, id])

Beamsplitter interaction.

BitFlip(p, wires[, id])

Single-qubit bit flip (Pauli \(X\)) error channel.

BlockEncode(A, wires)

Construct a unitary \(U(A)\) such that an arbitrary matrix \(A\) is encoded in the top-left block.

BooleanFn(fn)

Wrapper for simple callables with boolean output that can be manipulated and combined with bit-wise operators.

CCZ(wires)

CCZ (controlled-controlled-Z) gate.

CH(wires)

The controlled-Hadamard operator

CNOT(wires)

The controlled-NOT operator

CPhase

alias of pennylane.ops.op_math.controlled_ops.ControlledPhaseShift

CPhaseShift00(phi, wires[, id])

A qubit controlled phase shift.

CPhaseShift01(phi, wires[, id])

A qubit controlled phase shift.

CPhaseShift10(phi, wires[, id])

A qubit controlled phase shift.

CRX(phi, wires[, id])

The controlled-RX operator

CRY(phi, wires[, id])

The controlled-RY operator

CRZ(phi, wires[, id])

The controlled-RZ operator

CRot(phi, theta, omega, wires[, id])

The controlled-Rot operator

CSWAP(wires)

The controlled-swap operator

CVNeuralNetLayers(theta_1, phi_1, varphi_1, …)

A sequence of layers of a continuous-variable quantum neural network, as specified in Killoran et al. (2019).

CY(wires)

The controlled-Y operator

CZ(wires)

The controlled-Z operator

CatState(a, phi, p, wires[, id])

Prepares a cat state.

CircuitGraph(ops, obs, wires[, par_info, …])

Represents a quantum circuit as a directed acyclic graph.

ClassicalShadow(bits, recipes[, wire_map])

Class for classical shadow post-processing expectation values, approximate states, and entropies.

CoherentState(a, phi, wires[, id])

Prepares a coherent state.

CommutingEvolution(hamiltonian, time[, …])

Applies the time-evolution operator for a Hamiltonian expressed as a linear combination of mutually commuting Pauli words.

Configuration(name)

Configuration class.

ControlledAddition(s, wires[, id])

Controlled addition operation.

ControlledPhase(s, wires[, id])

Controlled phase operation.

ControlledPhaseShift(phi, wires[, id])

A qubit controlled phase shift.

ControlledQubitUnitary(U, control_wires, …)

Apply an arbitrary fixed unitary to wires with control from the control_wires.

ControlledQutritUnitary(U, control_wires, …)

Apply an arbitrary fixed unitary to wires with control from the control_wires.

ControlledSequence(base, control[, id])

Creates a sequence of controlled gates raised to decreasing powers of 2.

CosineWindow(wires)

Prepares an initial state with a cosine wave function.

CrossKerr(kappa, wires[, id])

Cross-Kerr interaction.

CubicPhase(gamma, wires[, id])

Cubic phase shift.

DepolarizingChannel(p, wires[, id])

Single-qubit symmetrically depolarizing error channel.

Device([wires, shots, analytic])

Abstract base class for PennyLane devices.

DeviceError

Exception raised by a Device when it encounters an illegal operation in the quantum circuit.

DiagonalQubitUnitary(D, wires)

Apply an arbitrary diagonal unitary matrix with a dimension that is a power of two.

DisplacedSqueezedState(a, phi_a, r, phi_r, wires)

Prepares a displaced squeezed vacuum state.

Displacement(a, phi, wires[, id])

Phase space displacement.

DisplacementEmbedding(features, wires[, …])

Encodes \(N\) features into the displacement amplitudes \(r\) or phases \(\phi\) of \(M\) modes, where \(N\leq M\).

DoubleExcitation(phi, wires[, id])

Double excitation rotation.

DoubleExcitationMinus(*params[, wires, id])

Double excitation rotation with negative phase-shift outside the rotation subspace.

DoubleExcitationPlus(phi, wires[, id])

Double excitation rotation with positive phase-shift outside the rotation subspace.

ECR(wires)

An echoed RZX(pi/2) gate.

FABLE(input_matrix, wires[, tol, id])

Construct a unitary with the fast approximate block encoding method.

FermiA(orbital)

The fermionic annihilation operator \(a\)

FermiC(orbital)

The fermionic creation operator \(a^{\dagger}\)

FermionicDoubleExcitation(weight[, wires1, …])

Circuit to exponentiate the tensor product of Pauli matrices representing the double-excitation operator entering the Unitary Coupled-Cluster Singles and Doubles (UCCSD) ansatz.

FermionicSWAP(phi, wires[, id])

Fermionic SWAP rotation.

FermionicSingleExcitation(weight[, wires, id])

Circuit to exponentiate the tensor product of Pauli matrices representing the single-excitation operator entering the Unitary Coupled-Cluster Singles and Doubles (UCCSD) ansatz.

FlipSign(n, wires[, id])

Flips the sign of a given basis state.

FockDensityMatrix(state, wires[, id])

Prepare subsystems using the given density matrix in the Fock basis.

FockState(n, wires[, id])

Prepares a single Fock state.

FockStateProjector(n, wires[, id])

The number state observable \(\ket{n}\bra{n}\).

FockStateVector(state, wires[, id])

Prepare subsystems using the given ket vector in the Fock basis.

GateFabric(weights, wires, init_state[, …])

Implements a local, expressive, and quantum-number-preserving ansatz proposed by Anselmetti et al. (2021).

GaussianState(V, r, wires[, id])

Prepare subsystems in a given Gaussian state.

GellMann(wires[, index, id])

The Gell-Mann observables for qutrits

GeneralizedAmplitudeDamping(gamma, p, wires)

Single-qubit generalized amplitude damping error channel.

GlobalPhase(phi[, wires, id])

A global phase operation that multiplies all components of the state by \(e^{-i \phi}\).

GradientDescentOptimizer([stepsize])

Basic gradient-descent optimizer.

GroverOperator([wires, work_wires, id])

Performs the Grover Diffusion Operator.

Hadamard(wires)

The Hadamard operator

Hamiltonian(coeffs, observables[, simplify, …])

Operator representing a Hamiltonian.

Hermitian(A, wires[, id])

An arbitrary Hermitian observable.

HilbertSchmidt(*params, v_function, v_wires, …)

Create a Hilbert-Schmidt template that can be used to compute the Hilbert-Schmidt Test (HST).

I

The Identity operator

IQPEmbedding(features, wires[, n_repeats, …])

Encodes \(n\) features into \(n\) qubits using diagonal gates of an IQP circuit.

ISWAP(wires)

The i-swap operator

Identity([wires, id])

The Identity operator

IntegerComparator(value, geq, wires)

Apply a controlled Pauli X gate using integer comparison as the condition.

Interferometer(theta, phi, varphi, wires[, …])

General linear interferometer, an array of beamsplitters and phase shifters.

InterferometerUnitary(U, wires[, id])

A linear interferometer transforming the bosonic operators according to the unitary matrix \(U\).

IsingXX(phi, wires[, id])

Ising XX coupling gate

IsingXY(phi, wires[, id])

Ising (XX + YY) coupling gate

IsingYY(phi, wires[, id])

Ising YY coupling gate

IsingZZ(phi, wires[, id])

Ising ZZ coupling gate

Kerr(kappa, wires[, id])

Kerr interaction.

LocalHilbertSchmidt(*params, v_function, …)

Create a Local Hilbert-Schmidt template that can be used to compute the Local Hilbert-Schmidt Test (LHST).

MERA(wires, n_block_wires, block, n_params_block)

The MERA template broadcasts an input circuit across many wires following the architecture of a multi-scale entanglement renormalization ansatz tensor network.

MPS(wires, n_block_wires, block[, …])

The MPS template broadcasts an input circuit across many wires following the architecture of a Matrix Product State tensor network.

MomentumOptimizer([stepsize, momentum])

Gradient-descent optimizer with momentum.

MottonenStatePreparation(state_vector, wires)

Prepares an arbitrary state on the given wires using a decomposition into gates developed by Möttönen et al. (2004).

MultiControlledX(control_wires, wires, …)

Apply a Pauli X gate controlled on an arbitrary computational basis state.

MultiRZ(theta[, wires, id])

Arbitrary multi Z rotation.

NesterovMomentumOptimizer([stepsize, momentum])

Gradient-descent optimizer with Nesterov momentum.

NumberOperator(wires)

The photon number observable \(\langle \hat{n}\rangle\).

OrbitalRotation(phi, wires[, id])

Spin-adapted spatial orbital rotation.

PCPhase(phi, dim, wires)

A projector-controlled phase gate.

PSWAP(phi, wires[, id])

Phase SWAP gate

ParticleConservingU1(weights, wires[, …])

Implements the heuristic VQE ansatz for quantum chemistry simulations using the particle-conserving gate \(U_{1,\mathrm{ex}}\) proposed by Barkoutsos et al. in arXiv:1805.04340.

ParticleConservingU2(weights, wires[, …])

Implements the heuristic VQE ansatz for Quantum Chemistry simulations using the particle-conserving entangler \(U_\mathrm{ent}(\vec{\theta}, \vec{\phi})\) proposed in arXiv:1805.04340.

PauliError(operators, p[, wires, id])

Pauli operator error channel for an arbitrary number of qubits.

PauliRot(theta, pauli_word[, wires, id])

Arbitrary Pauli word rotation.

PauliX(*params[, wires, id])

The Pauli X operator

PauliY(*params[, wires, id])

The Pauli Y operator

PauliZ(*params[, wires, id])

The Pauli Z operator

PennyLaneDeprecationWarning

Warning raised when a PennyLane feature is being deprecated.

Permute(permutation, wires[, id])

Applies a permutation to a set of wires.

PhaseDamping(gamma, wires[, id])

Single-qubit phase damping error channel.

PhaseFlip(p, wires[, id])

Single-qubit bit flip (Pauli \(Z\)) error channel.

PhaseShift(phi, wires[, id])

Arbitrary single qubit local phase shift

PolyXP(q, wires[, id])

An arbitrary second-order polynomial observable.

Projector(state, wires[, id])

Observable corresponding to the state projector \(P=\ket{\phi}\bra{\phi}\).

QAOAEmbedding(features, weights, wires[, …])

Encodes \(N\) features into \(n>N\) qubits, using a layered, trainable quantum circuit that is inspired by the QAOA ansatz proposed by Killoran et al. (2020).

QDrift(hamiltonian, time[, n, seed, …])

An operation representing the QDrift approximation for the complex matrix exponential of a given Hamiltonian.

QFT(wires)

Apply a quantum Fourier transform (QFT).

QNGOptimizer([stepsize, approx, lam])

Optimizer with adaptive learning rate, via calculation of the diagonal or block-diagonal approximation to the Fubini-Study metric tensor.

QNSPSAOptimizer([stepsize, regularization, …])

Quantum natural SPSA (QNSPSA) optimizer.

QNode(func, device[, interface, …])

Represents a quantum node in the hybrid computational graph.

QSVT(UA,projectors)

Implements the quantum singular value transformation (QSVT) circuit.

QuadOperator(phi, wires[, id])

The generalized quadrature observable \(\x_\phi = \x cos\phi+\p\sin\phi\).

QuadP(wires)

The momentum quadrature observable \(\hat{p}\).

QuadX(wires)

The position quadrature observable \(\hat{x}\).

QuadraticPhase(s, wires[, id])

Quadratic phase shift.

QuantumFunctionError

Exception raised when an illegal operation is defined in a quantum function.

QuantumMonteCarlo(probs, func, target_wires, …)

Performs the quantum Monte Carlo estimation algorithm.

QuantumPhaseEstimation(unitary[, …])

Performs the quantum phase estimation circuit.

QubitCarry(wires)

Apply the QubitCarry operation to four input wires.

QubitChannel(K_list[, wires, id])

Apply an arbitrary fixed quantum channel.

QubitDensityMatrix(state, wires)

Prepare subsystems using the given density matrix.

QubitDevice([wires, shots, r_dtype, …])

Abstract base class for PennyLane qubit devices.

QubitStateVector(state, wires[, id])

QubitSum(wires)

Apply a QubitSum operation on three input wires.

QubitUnitary(U, wires)

Apply an arbitrary unitary matrix with a dimension that is a power of two.

Qubitization(hamiltonian, control[, id])

Applies the Qubitization operator.

QueuingManager()

Singleton global entry point for managing active recording contexts.

QutritBasisState(n, wires)

Prepares a single computational basis state for a qutrit system.

QutritBasisStatePreparation(basis_state, wires)

Prepares a basis state on the given wires using a sequence of TShift gates.

QutritDevice([wires, shots, r_dtype, …])

Abstract base class for PennyLane qutrit devices.

QutritUnitary(*params, wires)

Apply an arbitrary, fixed unitary matrix.

RMSPropOptimizer([stepsize, decay, eps])

Root mean squared propagation optimizer.

RX(phi, wires[, id])

The single qubit X rotation

RY(phi, wires[, id])

The single qubit Y rotation

RZ(phi, wires[, id])

The single qubit Z rotation

RandomLayers(weights, wires[, ratio_imprim, …])

Layers of randomly chosen single qubit rotations and 2-qubit entangling gates, acting on randomly chosen qubits.

Reflection(U[, alpha, reflection_wires, id])

Apply a reflection about a state \(|\Psi\rangle\).

ResetError(p0, p1, wires[, id])

Single-qubit Reset error channel.

RiemannianGradientOptimizer(circuit[, …])

Riemannian gradient optimizer.

Rot(phi, theta, omega, wires[, id])

Arbitrary single qubit rotation

Rotation(phi, wires[, id])

Phase space rotation.

RotoselectOptimizer([possible_generators])

Rotoselect gradient-free optimizer.

RotosolveOptimizer([substep_optimizer, …])

Rotosolve gradient-free optimizer.

S(wires)

The single-qubit phase gate

SISWAP(wires)

The square root of i-swap operator.

SPSAOptimizer([maxiter, alpha, gamma, c, A, a])

The Simultaneous Perturbation Stochastic Approximation method (SPSA) is a stochastic approximation algorithm for optimizing cost functions whose evaluation may involve noise.

SQISW

alias of pennylane.ops.qubit.non_parametric_ops.SISWAP

SWAP(wires)

The swap operator

SX(wires)

The single-qubit Square-Root X operator.

Select(ops, control[, id])

Applies specific input operations depending on the state of the designated control qubits.

ShotAdaptiveOptimizer(min_shots[, …])

Optimizer where the shot rate is adaptively calculated using the variances of the parameter-shift gradient.

SimplifiedTwoDesign(initial_layer_weights, …)

Layers consisting of a simplified 2-design architecture of Pauli-Y rotations and controlled-Z entanglers proposed in Cerezo et al. (2021).

SingleExcitation(phi, wires[, id])

Single excitation rotation.

SingleExcitationMinus(phi, wires[, id])

Single excitation rotation with negative phase-shift outside the rotation subspace.

SingleExcitationPlus(phi, wires[, id])

Single excitation rotation with positive phase-shift outside the rotation subspace.

Snapshot([tag, measurement])

The Snapshot operation saves the internal simulator state at specific execution steps of a quantum function.

SparseHamiltonian(H[, wires, id])

A Hamiltonian represented directly as a sparse matrix in Compressed Sparse Row (CSR) format.

SpecialUnitary(theta, wires[, id])

Gate from the group \(SU(N)\) with \(N=2^n\) for \(n\) qubits.

SqueezedState(r, phi, wires[, id])

Prepares a squeezed vacuum state.

Squeezing(r, phi, wires[, id])

Phase space squeezing.

SqueezingEmbedding(features, wires[, …])

Encodes \(N\) features into the squeezing amplitudes \(r \geq 0\) or phases \(\phi \in [0, 2\pi)\) of \(M\) modes, where \(N\leq M\).

StatePrep(state, wires)

Prepare subsystems using the given ket vector in the computational basis.

StronglyEntanglingLayers(weights, wires[, …])

Layers consisting of single qubit rotations and entanglers, inspired by the circuit-centric classifier design arXiv:1804.00633.

T(wires)

The single-qubit T gate

TAdd(wires)

The 2-qutrit controlled add gate

TClock(wires)

Ternary Clock gate

THadamard(wires, subspace)

The ternary Hadamard operator

THermitian(A, wires[, id])

An arbitrary Hermitian observable for qutrits.

TRX(phi, wires[, subspace, id])

The single qutrit X rotation

TRY(phi, wires[, subspace, id])

The single qutrit Y rotation

TRZ(phi, wires[, subspace, id])

The single qutrit Z rotation

TSWAP(wires)

The ternary swap operator.

TShift(wires)

The qutrit shift operator

TTN(wires, n_block_wires, block, n_params_block)

The TTN template broadcasts an input circuit across many wires following the architecture of a tree tensor network.

TensorN([wires])

The tensor product of the NumberOperator acting on different wires.

ThermalRelaxationError(pe, t1, t2, tq, wires)

Thermal relaxation error channel.

ThermalState(nbar, wires[, id])

Prepares a thermal state.

Toffoli(wires)

Toffoli (controlled-controlled-X) gate.

Tracker([dev, callback, persistent])

This class stores information about device executions and allows users to interact with that data upon individual executions and batches, even within parameter-shift gradients and optimization steps.

TrotterProduct(hamiltonian, time[, n, …])

An operation representing the Suzuki-Trotter product approximation for the complex matrix exponential of a given Hamiltonian.

TwoLocalSwapNetwork(wires[, acquaintances, …])

Apply two-local gate operations using a canonical 2-complete linear (2-CCL) swap network.

TwoModeSqueezing(r, phi, wires[, id])

Phase space two-mode squeezing.

U1(phi, wires[, id])

U1 gate.

U2(phi, delta, wires[, id])

U2 gate.

U3(theta, phi, delta, wires[, id])

Arbitrary single qubit unitary.

UCCSD(weights, wires[, s_wires, d_wires, …])

Implements the Unitary Coupled-Cluster Singles and Doubles (UCCSD) ansatz.

WireCut(wires)

The wire cut operation, used to manually mark locations for wire cuts.

X

The Pauli X operator

Y

The Pauli Y operator

Z

The Pauli Z operator

grad(func[, argnum, method, h])

Returns the gradient as a callable function of hybrid quantum-classical functions.

kUpCCGSD(weights, wires[, k, delta_sz, …])

Implements the k-Unitary Pair Coupled-Cluster Generalized Singles and Doubles (k-UpCCGSD) ansatz.

Variables