Skip to content

Commit

Permalink
fix: Use double precision when encoding matrix values
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Jul 5, 2024
1 parent a9bf156 commit c97d380
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/circuit_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct Bitstring {
/// A 2D matrix.
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq, Hash)]
#[serde(transparent)]
pub struct Matrix<T = f32> {
pub struct Matrix<T = f64> {
/// A 2D vector of complex numbers.
pub data: Vec<Vec<(T, T)>>,
}
Expand Down
8 changes: 4 additions & 4 deletions src/opbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ pub enum OpBox {
Unitary1qBox {
id: BoxID,
/// 2x2 matrix of complex numbers
matrix: [[(f32, f32); 2]; 2],
matrix: [[(f64, f64); 2]; 2],
},
/// Two-qubit operation defined as a unitary matrix.
Unitary2qBox {
id: BoxID,
/// 4x4 matrix of complex numbers
matrix: [[(f32, f32); 4]; 4],
matrix: [[(f64, f64); 4]; 4],
},
/// Three-qubit operation defined as a unitary matrix.
Unitary3qBox {
id: BoxID,
/// 8x8 matrix of complex numbers
matrix: Box<[[(f32, f32); 8]; 8]>,
matrix: Box<[[(f64, f64); 8]; 8]>,
},
/// Two-qubit operation defined in terms of a hermitian matrix and a phase.
ExpBox {
id: BoxID,
/// 4x4 matrix of complex numbers
matrix: [[(f32, f32); 4]; 4],
matrix: [[(f64, f64); 4]; 4],
/// Phase of the operation.
phase: f64,
},
Expand Down

0 comments on commit c97d380

Please sign in to comment.