| Crates.io | cpx-mat2by2 |
| lib.rs | cpx-mat2by2 |
| version | 0.1.3 |
| created_at | 2025-04-24 01:30:24.604218+00 |
| updated_at | 2025-06-19 07:43:22.254867+00 |
| description | To power the rust-quantum project, this library provides a robust AltMat type for a single qubit, specifically optimized for the intensive complex number multiplications required for quantum gate applications and tensor product operations. |
| homepage | |
| repository | https://github.com/enjuichang123/cpx-mat2by2.git |
| max_upload_size | |
| id | 1646515 |
| size | 93,738 |
cpx-mat2by2 is a Rust library for representing separable quantum states and structured 2×2 complex operators in quantum computation.
It is designed to integrate seamlessly with the cpx-coords crate, which provides coordinate-system-aware complex number types Cpx<T>, where T is typically f32 or f64.
This crate emphasizes canonical normalization of quantum states and operators, making equality checks robust, particularly useful when constructing entangled states or modeling non-trivial k-local operations.
Global phase is ignored in separable states and 2×2 matrices: canonicalization ensures the unique representation, which is only restored when coherent superpositions are explicitly handled.
Normalization is enforced to ensure:
c₀ ∈ ℝ₊)Matrix classification:
|ψ⟩⟨ψ||ψ⟩⟨ψ⊥| or |ψ⊥⟩⟨ψ||ket⟩⟨bra|Pauli-based representations (complex quaternion form) are used to encode all 2×2 operators, supporting both real (Hermitian) and complex coefficients.
Multi-qubit structures use BTreeMap<usize, _> (not HashMap) to ensure deterministic key ordering.
This facilitates consistent hashing and composability for high-level quantum operations in future crates.
This crate is part of the broader rust-quantum project, focused on efficient numerical quantum computation.
Add cpx-mat2by2 as a dependency to your Cargo.toml file:
[dependencies]
cpx-mat2by2 = "0.1.3" # Replace with the latest version
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you shall be licensed as above, without any additional terms or conditions.