Skip to main content

Crate bloq

Crate bloq 

Source
Expand description

Compile block graphs for fault-tolerant quantum circuits.

Workspace crates are available as graph, compile, ir, and other modules. Import common types and entry points with prelude. Use Result for workflows spanning these modules; Error preserves their typed failures and supports automatic conversion with ?.

The whole pipeline in one call:

use bloq::prelude::*;

let stim_text = compile_to_stim(&GalleryItem::CNOT.build(), 3)?;
assert!(stim_text.contains("QUBIT_COORDS"));

Spelled out, when the intermediate Bloq is wanted or a non-default CompileConfig applies:

use bloq::prelude::*;

let graph = GalleryItem::CNOT.build();
let bloq = compile(&graph, 3)?;
let stim_text = emit_bloq_stim(&bloq)?;
assert!(stim_text.contains("QUBIT_COORDS"));

Compiling many related graphs with one configuration can use a CompileContext to reuse their circuit templates.

Default features are empty, so library use pulls in no CLI dependencies. The separate bloq-cli package provides the bloq command-line binary and the shared runner used by Python. vm exposes physical execution. gltf and verify forward to bloq_graph/gltf and bloq_stim/verify respectively. graph-verify exposes graph-level logical verification without requiring the native Stim backend.

Re-exports§

pub use bloq_circuit as circuit;
pub use bloq_compile as compile;
pub use bloq_graph as graph;
pub use bloq_ir as ir;
pub use bloq_stim as stim;
pub use bloq_utils as utils;
pub use bloq_vm as vm;

Modules§

prelude
Graph authoring, compilation, and Stim emission, for use bloq::prelude::*.

Structs§

Error
A small container retaining the typed error from a Bloq workflow.

Functions§

compile_to_stim
Compile graph at distance and emit it as Stim circuit text.

Type Aliases§

Result
A result using the facade’s Error by default.