Expand description
§qft-rs - Native Rust SDK for Quantum File Type (.qft)
Production-grade Rust library for working with quantum states in the .qft format.
§Table of Contents
- Core Types - QftFile, QftState, QftError
- Builder API - Fluent interface for state construction
- I/O Operations - Load, save, streaming
- State Operations - Normalization, fidelity, inner products
- Conversion - To/from ndarray, Vec, iterators
- Async Support - Tokio-based async I/O (feature-gated)
§Quick Start
use qft::{QftFile, Result};
fn main() -> Result<()> {
// Create a 4-qubit state
let mut state = QftFile::new(4)?;
// Set to |0000⟩ + |1111⟩ (unnormalized)
state.set_amplitude(0, 1.0.into())?;
state.set_amplitude(15, 1.0.into())?;
state.normalize()?;
// Save to disk
state.save("state.qft")?;
// Load and verify
let loaded = QftFile::load("state.qft")?;
assert!((state.fidelity(&loaded)? - 1.0).abs() < 1e-10);
Ok(())
}Modules§
Structs§
- QftBuilder
- Builder for constructing QFT files with a fluent interface.
- QftConfig
- Configuration for QFT file operations
- QftFile
- A quantum state file in .qft format
Enums§
- QftError
- Error type for QFT operations
Functions§
- basis_
state - Create a computational basis state |i⟩.
- bell_
state - Create a Bell state (|00⟩ + |11⟩) / √2.
- ghz_
state - Create a GHZ state (|0…0⟩ + |1…1⟩) / √2.
- uniform_
state - Create a uniform superposition state.
Type Aliases§
- Result
- Result type alias for QFT operations