Skip to content

loqs.codepacks

QEC codepacks

A "codepack" is a reference implementation of a QECCode. Each codepack provides utility functions that return predefined QECCode objects for several common QEC code implementations. They are designed to give users an easy starting point for running logical qubit simulations with LoQS, and power users an example for pattern matching and/or a starting point for implementing their own QEC implementations.

Warning

Note that the provided codepacks are not necessarily optimized or even mapped to physical hardware (i.e. they may contain expanded gate sets, impose no connectivity constraints, etc.).

Each codepack module is generally defined by having a create_qec_code() function, which returns the desired QECCode object. This function may take arguments that influence the returned QECCode; for example, codepacks for scalable QEC codes may take a distance argument, QEC codes that have multiple auxiliary qubit reuse patterns or syndrome extraction schedules may provide those as options, etc. These options should be documented in the docstring of the relevant create_qec_code() functions.

Most codepacks also implement a create_ideal_model() function, which returns a BaseNoiseModel that represents a noiseless physical qubit model. This is primarily for testing, such that users can immediately use this as the default_noise_model parameter of QuantumProgram().

Note

The codepack API is subject to change; or rather, there currently is no enforced API, and one may be created in the future.

Examples:

>>> from loqs.codepacks import codepack_trivial_counter as cp
>>> code = cp.create_qec_code()
>>> code.name
'Trivial Counter Code'