Skip to main content

Crate qft

Crate qft 

Source
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

  1. Core Types - QftFile, QftState, QftError
  2. Builder API - Fluent interface for state construction
  3. I/O Operations - Load, save, streaming
  4. State Operations - Normalization, fidelity, inner products
  5. Conversion - To/from ndarray, Vec, iterators
  6. 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§

async_ioasync
Async I/O operations for QFT files.
prelude
Prelude for convenient imports.

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