Skip to main content

cqlib_core/device/
mod.rs

1// This code is part of Cqlib.
2//
3// (C) Copyright China Telecom Quantum Group 2026
4//
5// This code is licensed under the Apache License, Version 2.0. You may
6// obtain a copy of this license in the LICENSE.txt file in the root directory
7// of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8//
9// Any modifications or derivative works of this code must retain this
10// copyright notice, and modified files need to carry a notice indicating
11// that they have been altered from the originals.
12
13//! # Quantum Device Module
14//!
15//! This module provides types for modeling quantum hardware devices.
16//! It includes device topology, qubit layout mapping, noise models,
17//! and execution result handling.
18//!
19//! ## Key Components
20//!
21//! - [`Device`]: Quantum device specification with qubit and edge properties
22//! - [`Topology`]: Device connectivity graph
23//! - [`Layout`]: Logical to physical qubit mapping
24//! - [`NoiseModel`]: Noise simulation parameters
25//! - [`ExecutionResult`]: Measurement outcome collection
26//!
27//! ## Instruction capability semantics
28//!
29//! [`Topology`] describes directed physical connectivity only; a coupling edge
30//! does not by itself name the instructions executable on that edge.
31//! [`Device::native_gates`] is the device-wide default capability set. A qubit
32//! or directed edge with no local native instructions inherits the matching
33//! one- or two-qubit defaults. A non-empty local native-instruction list is a
34//! complete override for that physical location.
35//!
36//! Local capabilities are never synchronized back into the device defaults,
37//! and replacing the defaults does not remove local capabilities. Two-qubit
38//! capabilities are ordered: support on `(control, target)` does not imply
39//! support on `(target, control)`. Calibration data describes a supported
40//! instruction but does not create support for an otherwise unsupported one.
41//!
42//! Native capability writers validate their inputs and return [`DeviceError`].
43//! Device defaults accept standard gates acting on at most two qubits, while
44//! qubit and edge properties accept exactly one- and two-qubit standard gates,
45//! respectively. Validation completes before mutation, so a rejected update
46//! preserves the previous capability set.
47
48pub mod device_impl;
49pub mod error;
50pub mod layout;
51pub mod noise;
52pub mod qubit;
53pub mod result;
54pub mod topology;
55
56pub use device_impl::{Device, EdgeProp, InstructionProp, QubitProp};
57pub use error::{DeviceError, DeviceValidationError, LayoutError, TopologyError};
58pub use layout::Layout;
59pub use noise::{NoiseModel, OperationKey, ReadoutError, SingleQubitNoise, TwoQubitNoise};
60pub use qubit::{LogicalQubit, PhysicalQubit};
61pub use result::{ExecutionResult, Outcome, Status};
62pub use topology::Topology;