From 5f058c9b67e0f96e0dd89bbeff0afe8e08bde25b Mon Sep 17 00:00:00 2001 From: hachem Date: Fri, 18 Oct 2024 09:34:36 +0200 Subject: Allow named registers and tiny refactor --- libpsi-core/src/core/gates.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libpsi-core/src/core/gates.rs') diff --git a/libpsi-core/src/core/gates.rs b/libpsi-core/src/core/gates.rs index 97254fc..854313d 100644 --- a/libpsi-core/src/core/gates.rs +++ b/libpsi-core/src/core/gates.rs @@ -2,32 +2,32 @@ use crate::{complex, matrix, QuantumGate}; #[rustfmt::skip] lazy_static::lazy_static! { - pub static ref HADAMARD: QuantumGate = QuantumGate { + pub static ref HADAMARD: QuantumGate<'static> = QuantumGate { name: "H", matrix: matrix!([complex!(1.0, 0.0), complex!( 1.0, 0.0)]; [complex!(1.0, 0.0), complex!(-1.0, 0.0)]) * complex!(1.0/2.0_f64.sqrt(), 0.0) }; - pub static ref PAULI_X: QuantumGate = QuantumGate { + pub static ref PAULI_X: QuantumGate<'static> = QuantumGate { name: "Pauli-X", matrix: matrix!([complex!(0.0, 0.0), complex!(1.0, 0.0)]; [complex!(1.0, 0.0), complex!(0.0, 0.0)]) }; - pub static ref PAULI_Y: QuantumGate = QuantumGate { + pub static ref PAULI_Y: QuantumGate<'static> = QuantumGate { name: "Pauli-Y", matrix: matrix!([complex!(0.0, 0.0), complex!(0.0, -1.0)]; [complex!(0.0, 1.0), complex!(0.0, 0.0)]) }; - pub static ref PAULI_Z: QuantumGate = QuantumGate { + pub static ref PAULI_Z: QuantumGate<'static> = QuantumGate { name: "Pauli-Z", matrix: matrix!([complex!(1.0, 0.0), complex!( 0.0, 0.0)]; [complex!(0.0, 0.0), complex!(-1.0, 0.0)]) }; - pub static ref CNOT: QuantumGate = QuantumGate { + pub static ref CNOT: QuantumGate<'static> = QuantumGate { name: "CNOT", matrix: matrix!([complex!(1.0, 0.0), complex!(0.0, 0.0), complex!(0.0, 0.0), complex!(0.0, 0.0)]; [complex!(0.0, 0.0), complex!(1.0, 0.0), complex!(0.0, 0.0), complex!(0.0, 0.0)]; -- cgit v1.3