quantrs2-core-0.1.0-alpha.3 has been yanked.
QuantRS2-Core: Foundational Quantum Types
QuantRS2-Core is part of the QuantRS2 quantum computing framework, providing the foundational types and traits that form the basis of the entire ecosystem.
Features
- Type-Safe Qubit Identifiers: Zero-cost abstractions for qubit references
- Comprehensive Gate Definitions: Standard quantum gates with matrix representations
- Register Abstractions: Quantum register types with const generics for compile-time validation
- Robust Error Handling: Comprehensive error types and result wrappers
Usage
Basic Example
use *;
Creating Custom Gates
use *;
use Complex64;
;
Module Structure
- error.rs: Error types and result wrappers
- gate.rs: Gate trait definitions and standard gate implementations
- qubit.rs: Qubit identifier type
- register.rs: Quantum register abstractions
API Overview
Core Types
QubitId: Type-safe wrapper around a qubit identifierRegister<N>: Fixed-size quantum register using const genericsQuantRS2Error: Error enumeration for all possible errorsQuantRS2Result<T>: Convenient result type alias
Important Traits
GateOp: Trait for quantum gates with matrix representationControlledOp: Trait for controlled quantum operationsStateVector: Trait for quantum state representations
Implementation Notes
- The
QubitIdtype is a zero-cost abstraction using#[repr(transparent)] - Gates are represented by their matrix form in column-major order
- Registers use Rust's const generics feature for compile-time qubit count validation
- Error handling follows Rust's standard practices with a custom error type
Future Plans
See TODO.md for planned improvements and features.
Integration with Other QuantRS2 Modules
This module is designed to work seamlessly with:
- quantrs2-circuit: Provides core types used in circuit construction
- quantrs2-sim: Provides matrix representations used in simulation
License
This project is licensed under either:
at your option.