Skip to content

Reference

Exhaustive, machine-oriented API documentation. This section is written to be parsed — by an AI coding agent, or by a person who already knows what they are looking for and wants the signature without the prose.

  • Complete API Reference


    Every public class and function across all 13 packages, with full signatures, parameter types, defaults, inheritance, members and exceptions. One page, ~280 entries.

For agents

If you are an AI agent working with this SDK, read the complete reference rather than the Guide or Packages sections. It is a single fetch, it is uniform, and it is generated from the installed code so it cannot disagree with the API you are calling.

The facts most likely to save you a wrong call:

  • Import paths. Only four packages define __all__ (quantum_network, quantum_error_correction, encoders, utils). Everything else must be imported from its module: from qndk.partition.kl import KernighanLinPartitioner, not from qndk.partition import .... Each reference entry states the path to prefer.
  • Partitioner subclasses implement _partition(), not partition(). The public partition() is a template method that wraps your return value. _partition() must return (QubitPartitionTracker, total_epr_count, [PartitionEvent]).
  • Circuit qubit ids are q_0, q_1, … — underscore included. Anything taking a manual qubit grouping expects those exact strings.
  • QPU.comp_qubits yields Qubit objects, not id strings. Use QuantumNetwork.all_comp_qubit_ids() when you want ids.
  • fault_tolerant_encode() requires a network with at least one magic state factory — build_clos(..., num_magic_factories=1). It raises otherwise and never mutates the network it is given.
  • tler() returns arrays, not scalars. Every term is swept over physical error rate, so budget.total[0] is the value at the lowest p.
  • The batch scheduler's makespan key is total_execution_cost, and wastage_per_qubit is an average idle time, not a fraction.
  • The SDK raises rather than falling back. Out-of-range model parameters, undersized networks and unsupported threshold rows all fail loudly, with the valid range in the message. Treat an exception as information, not as something to retry around.

How this page is produced

The reference is generated from the installed package — signatures, type annotations, defaults, base classes, properties, methods, and the exceptions each function raises. It is regenerated for every release, so it matches the wheel it ships with.

Raises lists only what a function raises itself, typically argument validation on the way in. Exceptions propagating from deeper calls are not listed.

Elsewhere

The prose documentation covers what the reference deliberately does not — why a stage exists, which of several options to pick, and what the numbers mean:

Looking for Go to
What the SDK is for Introduction
A first working run Getting Started
What a parameter name means Concepts
A worked problem Examples
Why a call raised Troubleshooting
How one package fits the pipeline Packages