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.

active_return()

Function that checks if the new return types system is activated.

adjoint(fn[, lazy])

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

adjoint_metric_tensor(circuit[, device, hybrid])

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(fn, wires, target_wire, …)

Provides the circuit to apply a controlled version of the \(\mathcal{Q}\) unitary defined in this paper.

batch_input(tape, argnum)

Transform a QNode 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.

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

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

classical_shadow(wires[, seed_recipes])

The classical shadow measurement protocol.

commutation_dag(circuit)

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

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

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

cond(condition, true_fn[, false_fn])

Condition a quantum operation on 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)

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[, wires])

Load a Device and return the instance.

disable_return()

Function that turns off the new return type system.

dot(x, y)

Lazily perform the dot product between arrays, tensors, and QNodeCollection.

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

Create a function that draws the given qnode.

draw_mpl(qnode[, wire_order, …])

Draw a qnode with matplotlib

eigvals(op[, k, which])

The eigenvalues of one or more operations.

enable_return()

Function that turns on the new return type system.

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

Function for determining operator equality.

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

Execute a batch of tapes on a device in an autodifferentiable-compatible manner.

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

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

exp(op[, coeff, id])

Take the exponential of an Operator times a coefficient.

expval(op)

Expectation value of the supplied observable.

from_pyquil(pyquil_program)

Loads pyQuil Program objects by using the converter in the PennyLane-Forest 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)

Loads Qiskit QuantumCircuit objects by using the converter in the PennyLane-Qiskit plugin.

from_quil(quil)

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

from_quil_file(quil_filename)

Loads quantum circuits from a Quil file using the converter in the PennyLane-Forest 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.

jacobian(func[, argnum])

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

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

Repeatedly applies a unitary a given number of times.

load(quantum_circuit_object, format)

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

map(template, observables, device[, …])

Map a quantum template over a list of observables to create a QNodeCollection.

matrix(op, *[, wire_order])

The matrix representation of an operation or quantum circuit.

measure(wires)

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

measurement_grouping(tape, obs_list, coeffs_list)

Returns a list of measurement optimized tapes, and a classical processing function, for evaluating the expectation value of a provided Hamiltonian.

metric_tensor(tape[, 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:

op_sum(*summands[, do_queue, id])

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

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).

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, do_queue, id])

Raise an Operator to a power.

probs([wires, op])

Probability of each computational basis state.

prod(*ops[, do_queue, id])

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

qfunc_transform(tape_transform)

Given a function which defines a tape transform, convert the function into one that applies the tape transform to quantum functions (qfuncs).

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

Represents a quantum node in the hybrid computational graph.

quantum_monte_carlo(fn, wires, target_wire, …)

Provides the circuit to perform the quantum Monte Carlo estimation algorithm.

refresh_devices()

Scan installed PennyLane plugins to refresh the device list.

s_prod(scalar, operator[, do_queue, 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_recipes])

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.

sum(x)

Lazily sum the constituent QNodes of a QNodeCollection.

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 taper qubits.

var(op)

Variance of the supplied observable.

version()

Returns the PennyLane version number.

vn_entropy(wires[, log_base])

Von Neumann entropy of the system prior to measurement.

Classes

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.

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.

AmplitudeDamping(gamma, wires[, do_queue, 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, …])

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

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

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

ArbitraryStatePreparation(weights, wires[, …])

Implements an arbitrary state preparation on the specified wires.

ArbitraryUnitary(weights, wires[, do_queue, 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[, do_queue, id])

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

BasisState(n, wires)

Prepares a single computational basis state.

BasisStatePreparation(basis_state, wires[, …])

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

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

Beamsplitter interaction.

BitFlip(p, wires[, do_queue, id])

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

BooleanFn(fn)

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

CNOT(wires)

The controlled-NOT operator

CPhase

alias of pennylane.ops.qubit.parametric_ops.ControlledPhaseShift

CRX(phi, wires[, do_queue, id])

The controlled-RX operator

CRY(phi, wires[, do_queue, id])

The controlled-RY operator

CRZ(phi, wires[, do_queue, id])

The controlled-RZ operator

CRot(phi, theta, omega, wires[, do_queue, 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[, do_queue, 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[, do_queue, 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[, do_queue, id])

Controlled addition operation.

ControlledPhase(s, wires[, do_queue, id])

Controlled phase operation.

ControlledPhaseShift(phi, wires[, do_queue, id])

A qubit controlled phase shift.

ControlledQubitUnitary(U, control_wires, …)

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

CrossKerr(kappa, wires[, do_queue, id])

Cross-Kerr interaction.

CubicPhase(gamma, wires[, do_queue, id])

Cubic phase shift.

DepolarizingChannel(p, wires[, do_queue, 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 fixed diagonal unitary matrix.

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

Prepares a displaced squeezed vacuum state.

Displacement(a, phi, wires[, do_queue, 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[, do_queue, id])

Double excitation rotation.

DoubleExcitationMinus(*params[, wires, …])

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

DoubleExcitationPlus(phi, wires[, do_queue, id])

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

ECR(wires)

An echoed RZX(pi/2) gate.

ExpvalCost(ansatz, hamiltonian, device[, …])

Create a cost function that gives the expectation value of an input Hamiltonian.

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.

FermionicSingleExcitation(weight[, wires, …])

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[, do_queue, id])

FlipSign operator flips the sign for a given basic state.

FockDensityMatrix(state, wires[, do_queue, id])

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

FockState(n, wires[, do_queue, id])

Prepares a single Fock state.

FockStateProjector(n, wires[, do_queue, id])

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

FockStateVector(state, wires[, do_queue, 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[, do_queue, id])

Prepare subsystems in a given Gaussian state.

GeneralizedAmplitudeDamping(gamma, p, wires)

Single-qubit generalized amplitude damping error channel.

GradientDescentOptimizer([stepsize])

Basic gradient-descent optimizer.

GroverOperator([wires, work_wires, do_queue, id])

Performs the Grover Diffusion Operator.

Hadamard(wires)

The Hadamard operator

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

Operator representing a Hamiltonian.

Hermitian(A, wires[, do_queue, 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).

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)

The identity observable \(\I\).

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

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

InterferometerUnitary(U, wires[, do_queue, id])

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

IsingXX(phi, wires[, do_queue, id])

Ising XX coupling gate

IsingXY(phi, wires[, do_queue, id])

Ising (XX + YY) coupling gate

IsingYY(phi, wires[, do_queue, id])

Ising YY coupling gate

IsingZZ(phi, wires[, do_queue, id])

Ising ZZ coupling gate

Kerr(kappa, wires[, do_queue, id])

Kerr interaction.

LieAlgebraOptimizer(circuit[, stepsize, …])

Lie algebra optimizer.

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, n_params_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, do_queue, 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[, do_queue, id])

Spin-adapted spatial orbital rotation.

P(wires)

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

PSWAP(phi, wires[, do_queue, 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, do_queue, id])

Pauli operator error channel for an arbitrary number of qubits.

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

Arbitrary Pauli word rotation.

PauliX(wires)

The Pauli X operator

PauliY(wires)

The Pauli Y operator

PauliZ(wires)

The Pauli Z operator

Permute(permutation, wires[, do_queue, id])

Applies a permutation to a set of wires.

PhaseDamping(gamma, wires[, do_queue, id])

Single-qubit phase damping error channel.

PhaseFlip(p, wires[, do_queue, id])

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

PhaseShift(phi, wires[, do_queue, id])

Arbitrary single qubit local phase shift

PolyXP(q, wires[, do_queue, id])

An arbitrary second-order polynomial observable.

Projector(basis_state, wires[, do_queue, id])

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

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

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

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.

QNodeCollection([qnodes])

Represents a sequence of independent QNodes that all share the same signature.

QuadOperator(phi, wires[, do_queue, id])

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

QuadraticPhase(s, wires[, do_queue, 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, do_queue, 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)

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

QubitSum(wires)

Apply a QubitSum operation on three input wires.

QubitUnitary(U, wires)

Apply an arbitrary fixed unitary matrix.

QueuingContext()

Abstract base class for classes that exposes a queue for objects.

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

Abstract base class for PennyLane qutrit devices.

QutritUnitary(*params, wires[, do_queue])

Apply an arbitrary, fixed unitary matrix.

RMSPropOptimizer([stepsize, decay, eps])

Root mean squared propagation optimizer.

RX(phi, wires[, do_queue, id])

The single qubit X rotation

RY(phi, wires[, do_queue, id])

The single qubit Y rotation

RZ(phi, wires[, do_queue, 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.

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

Single-qubit Reset error channel.

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

Arbitrary single qubit rotation

Rotation(phi, wires[, do_queue, 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.

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[, do_queue, id])

Single excitation rotation.

SingleExcitationMinus(phi, wires[, do_queue, id])

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

SingleExcitationPlus(phi, wires[, do_queue, id])

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

Snapshot([tag, do_queue])

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

SparseHamiltonian(H[, wires, do_queue, id])

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

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

Prepares a squeezed vacuum state.

Squeezing(r, phi, wires[, do_queue, 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\).

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

THermitian(A, wires[, do_queue, id])

An arbitrary Hermitian observable for qutrits.

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[, do_queue, 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.

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

Phase space two-mode squeezing.

U1(phi, wires[, do_queue, id])

U1 gate.

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

U2 gate.

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

Arbitrary single qubit unitary.

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

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

VQECost(*args, **kwargs)

Create a cost function that gives the expectation value of an input Hamiltonian.

WireCut(wires)

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

X(wires)

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

batch_transform(*args, **kwargs)

Class for registering a tape transform that takes a tape, and outputs a batch of tapes to be independently executed on a quantum device.

grad(fun[, argnum])

Returns the gradient as a callable function of (functions of) QNodes.

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

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

op_transform(*args, **kwargs)

Convert a function that applies to operators into a functional transform.

single_tape_transform(transform_fn)

For registering a tape transform that takes a tape and outputs a single new tape.

Variables

Class Inheritance Diagram

Inheritance diagram of pennylane.optimize.adagrad.AdagradOptimizer, pennylane.optimize.adam.AdamOptimizer, pennylane.templates.subroutines.all_singles_doubles.AllSinglesDoubles, pennylane.ops.channel.AmplitudeDamping, pennylane.templates.embeddings.amplitude.AmplitudeEmbedding, pennylane.templates.embeddings.angle.AngleEmbedding, pennylane.templates.subroutines.approx_time_evolution.ApproxTimeEvolution, pennylane.templates.state_preparations.arbitrary_state_preparation.ArbitraryStatePreparation, pennylane.templates.subroutines.arbitrary_unitary.ArbitraryUnitary, pennylane.ops.qubit.non_parametric_ops.Barrier, pennylane.templates.layers.basic_entangler.BasicEntanglerLayers, pennylane.templates.embeddings.basis.BasisEmbedding, pennylane.ops.qubit.state_preparation.BasisState, pennylane.templates.state_preparations.basis.BasisStatePreparation, pennylane.ops.cv.Beamsplitter, pennylane.ops.channel.BitFlip, pennylane.boolean_fn.BooleanFn, pennylane.ops.qubit.non_parametric_ops.CNOT, pennylane.ops.qubit.parametric_ops.ControlledPhaseShift, pennylane.ops.qubit.parametric_ops.CRX, pennylane.ops.qubit.parametric_ops.CRY, pennylane.ops.qubit.parametric_ops.CRZ, pennylane.ops.qubit.parametric_ops.CRot, pennylane.ops.qubit.non_parametric_ops.CSWAP, pennylane.templates.layers.cv_neural_net.CVNeuralNetLayers, pennylane.ops.qubit.non_parametric_ops.CY, pennylane.ops.qubit.non_parametric_ops.CZ, pennylane.ops.cv.CatState, pennylane.circuit_graph.CircuitGraph, pennylane.shadows.classical_shadow.ClassicalShadow, pennylane.ops.cv.CoherentState, pennylane.templates.subroutines.commuting_evolution.CommutingEvolution, pennylane.configuration.Configuration, pennylane.ops.cv.ControlledAddition, pennylane.ops.cv.ControlledPhase, pennylane.ops.qubit.parametric_ops.ControlledPhaseShift, pennylane.ops.qubit.matrix_ops.ControlledQubitUnitary, pennylane.ops.cv.CrossKerr, pennylane.ops.cv.CubicPhase, pennylane.ops.channel.DepolarizingChannel, pennylane._device.Device, pennylane._device.DeviceError, pennylane.ops.qubit.matrix_ops.DiagonalQubitUnitary, pennylane.ops.cv.DisplacedSqueezedState, pennylane.ops.cv.Displacement, pennylane.templates.embeddings.displacement.DisplacementEmbedding, pennylane.ops.qubit.qchem_ops.DoubleExcitation, pennylane.ops.qubit.qchem_ops.DoubleExcitationMinus, pennylane.ops.qubit.qchem_ops.DoubleExcitationPlus, pennylane.ops.qubit.non_parametric_ops.ECR, pennylane.vqe.vqe.ExpvalCost, pennylane.templates.subroutines.fermionic_double_excitation.FermionicDoubleExcitation, pennylane.templates.subroutines.fermionic_single_excitation.FermionicSingleExcitation, pennylane.templates.subroutines.flip_sign.FlipSign, pennylane.ops.cv.FockDensityMatrix, pennylane.ops.cv.FockState, pennylane.ops.cv.FockStateProjector, pennylane.ops.cv.FockStateVector, pennylane.templates.layers.gate_fabric.GateFabric, pennylane.ops.cv.GaussianState, pennylane.ops.channel.GeneralizedAmplitudeDamping, pennylane.optimize.gradient_descent.GradientDescentOptimizer, pennylane.templates.subroutines.grover.GroverOperator, pennylane.ops.qubit.non_parametric_ops.Hadamard, pennylane.ops.qubit.hamiltonian.Hamiltonian, pennylane.ops.qubit.observables.Hermitian, pennylane.templates.subroutines.hilbert_schmidt.HilbertSchmidt, pennylane.templates.embeddings.iqp.IQPEmbedding, pennylane.ops.qubit.non_parametric_ops.ISWAP, pennylane.ops.identity.Identity, pennylane.templates.subroutines.interferometer.Interferometer, pennylane.ops.cv.InterferometerUnitary, pennylane.ops.qubit.parametric_ops.IsingXX, pennylane.ops.qubit.parametric_ops.IsingXY, pennylane.ops.qubit.parametric_ops.IsingYY, pennylane.ops.qubit.parametric_ops.IsingZZ, pennylane.ops.cv.Kerr, pennylane.optimize.lie_algebra.LieAlgebraOptimizer, pennylane.templates.subroutines.hilbert_schmidt.LocalHilbertSchmidt, pennylane.templates.tensornetworks.mera.MERA, pennylane.templates.tensornetworks.mps.MPS, pennylane.optimize.momentum.MomentumOptimizer, pennylane.templates.state_preparations.mottonen.MottonenStatePreparation, pennylane.ops.qubit.non_parametric_ops.MultiControlledX, pennylane.ops.qubit.parametric_ops.MultiRZ, pennylane.optimize.nesterov_momentum.NesterovMomentumOptimizer, pennylane.ops.cv.NumberOperator, pennylane.ops.qubit.qchem_ops.OrbitalRotation, pennylane.ops.cv.P, pennylane.ops.qubit.parametric_ops.PSWAP, pennylane.templates.layers.particle_conserving_u1.ParticleConservingU1, pennylane.templates.layers.particle_conserving_u2.ParticleConservingU2, pennylane.ops.channel.PauliError, pennylane.ops.qubit.parametric_ops.PauliRot, pennylane.ops.qubit.non_parametric_ops.PauliX, pennylane.ops.qubit.non_parametric_ops.PauliY, pennylane.ops.qubit.non_parametric_ops.PauliZ, pennylane.templates.subroutines.permute.Permute, pennylane.ops.channel.PhaseDamping, pennylane.ops.channel.PhaseFlip, pennylane.ops.qubit.parametric_ops.PhaseShift, pennylane.ops.cv.PolyXP, pennylane.ops.qubit.observables.Projector, pennylane.templates.embeddings.qaoaembedding.QAOAEmbedding, pennylane.templates.subroutines.qft.QFT, pennylane.optimize.qng.QNGOptimizer, pennylane.optimize.qnspsa.QNSPSAOptimizer, pennylane.qnode.QNode, pennylane.collections.qnode_collection.QNodeCollection, pennylane.ops.cv.QuadOperator, pennylane.ops.cv.QuadraticPhase, pennylane.QuantumFunctionError, pennylane.templates.subroutines.qmc.QuantumMonteCarlo, pennylane.templates.subroutines.qpe.QuantumPhaseEstimation, pennylane.ops.qubit.arithmetic_ops.QubitCarry, pennylane.ops.channel.QubitChannel, pennylane.ops.qubit.state_preparation.QubitDensityMatrix, pennylane._qubit_device.QubitDevice, pennylane.ops.qubit.state_preparation.QubitStateVector, pennylane.ops.qubit.arithmetic_ops.QubitSum, pennylane.ops.qubit.matrix_ops.QubitUnitary, pennylane.queuing.QueuingContext, pennylane._qutrit_device.QutritDevice, pennylane.ops.qutrit.matrix_ops.QutritUnitary, pennylane.optimize.rms_prop.RMSPropOptimizer, pennylane.ops.qubit.parametric_ops.RX, pennylane.ops.qubit.parametric_ops.RY, pennylane.ops.qubit.parametric_ops.RZ, pennylane.templates.layers.random.RandomLayers, pennylane.ops.channel.ResetError, pennylane.ops.qubit.parametric_ops.Rot, pennylane.ops.cv.Rotation, pennylane.optimize.rotoselect.RotoselectOptimizer, pennylane.optimize.rotosolve.RotosolveOptimizer, pennylane.ops.qubit.non_parametric_ops.S, pennylane.ops.qubit.non_parametric_ops.SISWAP, pennylane.optimize.spsa.SPSAOptimizer, pennylane.ops.qubit.non_parametric_ops.SISWAP, pennylane.ops.qubit.non_parametric_ops.SWAP, pennylane.ops.qubit.non_parametric_ops.SX, pennylane.optimize.shot_adaptive.ShotAdaptiveOptimizer, pennylane.templates.layers.simplified_two_design.SimplifiedTwoDesign, pennylane.ops.qubit.qchem_ops.SingleExcitation, pennylane.ops.qubit.qchem_ops.SingleExcitationMinus, pennylane.ops.qubit.qchem_ops.SingleExcitationPlus, pennylane.ops.snapshot.Snapshot, pennylane.ops.qubit.observables.SparseHamiltonian, pennylane.ops.cv.SqueezedState, pennylane.ops.cv.Squeezing, pennylane.templates.embeddings.squeezing.SqueezingEmbedding, pennylane.templates.layers.strongly_entangling.StronglyEntanglingLayers, pennylane.ops.qubit.non_parametric_ops.T, pennylane.ops.qutrit.non_parametric_ops.TAdd, pennylane.ops.qutrit.non_parametric_ops.TClock, pennylane.ops.qutrit.observables.THermitian, pennylane.ops.qutrit.non_parametric_ops.TSWAP, pennylane.ops.qutrit.non_parametric_ops.TShift, pennylane.templates.tensornetworks.ttn.TTN, pennylane.ops.cv.TensorN, pennylane.ops.channel.ThermalRelaxationError, pennylane.ops.cv.ThermalState, pennylane.ops.qubit.non_parametric_ops.Toffoli, pennylane.tracker.Tracker, pennylane.ops.cv.TwoModeSqueezing, pennylane.ops.qubit.parametric_ops.U1, pennylane.ops.qubit.parametric_ops.U2, pennylane.ops.qubit.parametric_ops.U3, pennylane.templates.subroutines.uccsd.UCCSD, pennylane.vqe.vqe.VQECost, pennylane.ops.qubit.non_parametric_ops.WireCut, pennylane.ops.cv.X, pennylane.transforms.batch_transform.batch_transform, pennylane._grad.grad, pennylane.templates.subroutines.kupccgsd.kUpCCGSD, pennylane.transforms.op_transforms.op_transform, pennylane.transforms.qfunc_transforms.single_tape_transform