PennyLane Python Frontend

Module: catalyst

This package contains the Catalyst Python interface.

Functions

qjit([fn, autograph, autograph_include, ...])

A just-in-time decorator for PennyLane and JAX programs using Catalyst.

debug_assert(condition, error)

Asserts at runtime that the given condition holds, raising an error with the provided message if it does not.

accelerate([func, dev])

Execute a jax.jit accelerated function on classical accelerators such as GPUs from within a qjit-compiled function.

pure_callback(callback_fn[, result_type])

Execute and return the results of a functionally pure Python function from within a qjit-compiled function.

cond(pred)

A qjit() compatible decorator for if-else conditionals in PennyLane/Catalyst.

for_loop(lower_bound, upper_bound, step[, ...])

A qjit() compatible for-loop decorator for PennyLane/Catalyst.

while_loop(cond_fn[, allow_array_resizing])

A qjit() compatible while-loop decorator for PennyLane/Catalyst.

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

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

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

A qjit() compatible gradient transformation for PennyLane/Catalyst.

value_and_grad([fn, method, h, argnum])

A qjit()-compatible transformation for returning the result and gradient of a function.

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

A qjit() compatible Jacobian transformation for PennyLane/Catalyst.

vjp(f, params, cotangents, *[, method, h, ...])

A qjit() compatible Vector-Jacobian product for PennyLane/Catalyst.

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

A qjit() compatible Jacobian-vector product for PennyLane/Catalyst.

mitigate_with_zne([fn, scale_factors, ...])

A qjit() compatible error mitigation of an input circuit using zero-noise extrapolation.

vmap([fn, in_axes, out_axes, axis_size])

A qjit() compatible vectorizing map.

measure(wires[, reset, postselect])

A qjit() compatible mid-circuit measurement on 1 qubit for PennyLane/Catalyst.

adjoint(f[, lazy])

A qjit() compatible adjoint transformer for PennyLane/Catalyst.

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

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

autograph_source(fn)

Utility function to retrieve the source code of a function converted by AutoGraph.

run_autograph(fn)

Decorator that converts the given function into graph form.

Classes

QJIT(fn, compile_options)

Class representing a just-in-time compiled hybrid quantum-classical function.

AutoGraphError

Errors related to Catalyst's AutoGraph module.

CompileError

Error encountered in the compilation phase.

DifferentiableCompileError

An error indicating an invalid differentiation configuration.

CompileOptions(verbose, logfile, target, ...)

Generic compilation options, for which reasonable default values exist.

Variables

autograph_ignore_fallbacks

Specify whether AutoGraph should avoid raising warnings when conversion fails and control flow instead falls back to being interpreted by Python at compile-time.

autograph_strict_conversion

Specify whether AutoGraph should raise exceptions when conversion fails, rather than falling back to interpreting control flow by Python at compile-time.

disable_autograph

Context decorator that disables AutoGraph for the given function/context.

Module: catalyst.debug

Catalyst’s debug module contains functions useful for user program debugging.

Functions

callback(callback_fn)

Execute a Python function with no return value and potential side effects from within a qjit-compiled function.

print(fmt, *args, **kwargs)

A qjit() compatible print function for printing values at runtime.

print_memref(x)

A qjit() compatible print function for printing numeric values at runtime with memref information.

print_compilation_stage(fn, stage)

Print one of the recorded compilation stages for a JIT-compiled function.

get_cmain(fn, *args)

Return a C program that calls a jitted function with the provided arguments.

compile_from_mlir(ir[, compiler, ...])

Compile a Catalyst function to binary code from the provided MLIR.

instrumentation(session_name[, filename, ...])

Instrumentation session to output information on wall time, CPU time, and intermediate program size of a program during compilation and execution.

Module: catalyst.third_party.cuda

This module contains a CudaQDevice and the qjit entry point.

Functions

cudaqjit([fn])

A decorator for compiling PennyLane and JAX programs using CUDA Quantum.

Classes

BaseCudaInstructionSet([shots, wires])

Base instruction set for CUDA-Quantum devices

SoftwareQQPP([shots, wires])

The SoftwareQ Q++ statevector simulator.

NvidiaCuStateVec([shots, wires, multi_gpu])

The NVIDIA CuStateVec GPU simulator (with support for multi-gpu).

NvidiaCuTensorNet([shots, wires, mps])

The NVIDIA CuTensorNet GPU simulator (with support for matrix product state)