Skip to content

Commit

Permalink
Adding GateDefinition and CallDefinedGate (#546)
Browse files Browse the repository at this point in the history
* wip

* wip

* DefinitionGate Ok

* only works with the feature

* cargolock

* corrections

* refactor comments

* thanks Matteo

* version

* wip

* almost there

* save before mass replace

* save before mass replace

* it compiles

* Update qoqo to pyo3 0.21

* format test like the others

* version, dependencies and changelog

* toml patch

* git patch

* clippy

* compatibility test patch

* remove useless binds

* from_bound_pyany

* cargo clippy

* use bound

* toml

* unstable features fix

* cargo clippy

* save before replace

* pyo3 update

* clippy stuff

* more clippy

* lots of clippy

* last few clippy

* compatibility tests corrections

* no patches

* probably to remove

* working build solution

* docstring corrections

* compatibility test

* compatibility test

* compatibility test name

* compatibility test and update

* changelog

* PR review

* function name

* pr changes

* cargo update

* standardize python types

* doc

---------

Co-authored-by: mlodi-hqs <[email protected]>
  • Loading branch information
dberthault and mlodi-hqs authored May 24, 2024
1 parent dda5fb3 commit cdf58c2
Show file tree
Hide file tree
Showing 69 changed files with 3,504 additions and 1,233 deletions.
4 changes: 2 additions & 2 deletions .compatibility_tests/compatibility_test_1_0/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "compatibility_test_1_0"
version = "1.12.1"
version = "1.13.0"
authors = ["HQS Quantum Simulations <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -22,7 +22,7 @@ publish = false
test_roqoqo_1_0 = { package = "roqoqo", version = "=1.0.0" }
test_roqoqo_derive_1_0 = { package = "roqoqo-derive", version = "=1.0.0" }
qoqo_calculator = { version = "1.2" }
roqoqo = { version = "1.12.1", path = "../../roqoqo", features = [
roqoqo = { version = "1.13.0", path = "../../roqoqo", features = [
"serialize",
"overrotate",
] }
Expand Down
6 changes: 3 additions & 3 deletions .compatibility_tests/compatibility_test_1_10/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "compatibility_test_1_10"
version = "1.12.1"
authors = ["HQS Quantum Simulations <[email protected]>"]
name = "compatibility_test_1_10"
version = "1.13.0"
license = "Apache-2.0"
edition = "2021"
rust-version = "1.56"
Expand All @@ -22,7 +22,7 @@ publish = false
test_roqoqo_1_10 = { package = "roqoqo", version = "=1.10.0" }
test_roqoqo_derive_1_10 = { package = "roqoqo-derive", version = "=1.10.0" }
qoqo_calculator = { version = "1.2" }
roqoqo = { version = "1.12.1", path = "../../roqoqo", features = [
roqoqo = { version = "1.13.0", path = "../../roqoqo", features = [
"serialize",
"overrotate",
] }
Expand Down
4 changes: 2 additions & 2 deletions .compatibility_tests/compatibility_test_1_11/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "compatibility_test_1_11"
version = "1.12.1"
version = "1.13.0"
authors = ["HQS Quantum Simulations <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -22,7 +22,7 @@ publish = false
test_roqoqo_1_11 = { package = "roqoqo", version = "=1.11.0" }
test_roqoqo_derive_1_11 = { package = "roqoqo-derive", version = "=1.11.0" }
qoqo_calculator = { version = "1.2" }
roqoqo = { version = "1.12.1", path = "../../roqoqo", features = [
roqoqo = { version = "1.13.0", path = "../../roqoqo", features = [
"serialize",
"overrotate",
] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ use test_roqoqo_1_11;
// Operations from 1.11 - ApplyConstantSpinHamiltonian and ApplyTimeDependentHamiltonian are unstable in 1.11
// #[test_case(create_apply_constant_spin_hamiltonian(); "ApplyConstantSpinHamiltonian")]
// #[test_case(create_apply_timedependent_spin_hamiltonian(); "ApplyTimeDependentHamiltonian")]
fn test_bincode_compatibility_1_10(operation: test_roqoqo_1_11::operations::Operation) {
fn test_bincode_compatibility_1_11(operation: test_roqoqo_1_11::operations::Operation) {
let mut test_circuit = test_roqoqo_1_11::Circuit::new();
test_circuit += operation;

Expand Down
34 changes: 34 additions & 0 deletions .compatibility_tests/compatibility_test_1_12/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "compatibility_test_1_12"
version = "1.13.0"
authors = ["HQS Quantum Simulations <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
rust-version = "1.56"
categories = ["science", "simulation"]
homepage = "https://github.com/HQSquantumsimulations/qoqo"
repository = "https://github.com/HQSquantumsimulations/qoqo"
documentation = "https://docs.rs/roqoqo/"
readme = "../README.md"
description = "Compatibility tests for roqoqo"
include = ["src*", "build.rs", "LICENSE", "README.md"]
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace]

[dependencies]
test_roqoqo_1_12 = { package = "roqoqo", version = "=1.12.0" }
test_roqoqo_derive_1_12 = { package = "roqoqo-derive", version = "=1.12.0" }
qoqo_calculator = { version = "1.2" }
roqoqo = { version = "1.13.0", path = "../../roqoqo", features = [
"serialize",
"overrotate",
] }
struqture = { version = "1.7" }
bincode = { version = "1.3" }
ndarray = "0.15"

[dev-dependencies]
test-case = "3.0"
14 changes: 14 additions & 0 deletions .compatibility_tests/compatibility_test_1_12/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
// Copyright © 2023 HQS Quantum Simulations GmbH. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::HashMap;

use test_case::test_case;
use test_roqoqo_1_12;

// 1.0 version
#[test_case(test_roqoqo_1_12::operations::SingleQubitGate::new(0, 1.0.into(), 0.0.into(), 0.0.into(), 0.0.into(), 0.0.into(),).into(); "SingleQubitGate")]
#[test_case(test_roqoqo_1_12::operations::RotateZ::new(0, 0.1.into()).into(); "RotateZ")]
#[test_case(test_roqoqo_1_12::operations::RotateY::new(0, 0.1.into()).into(); "RotateY")]
#[test_case(test_roqoqo_1_12::operations::RotateX::new(0, 0.1.into()).into(); "RotateX")]
#[test_case(test_roqoqo_1_12::operations::RotateXY::new(0,1.0.into(), 0.1.into()).into(); "RotateXY")]
#[test_case(test_roqoqo_1_12::operations::RotateAroundSphericalAxis::new(0, 1.0.into(), 1.0.into(), 1.0.into()).into(); "RotateAroundSphericalAxis")]
#[test_case(test_roqoqo_1_12::operations::PauliZ::new(0).into(); "PauliZ")]
#[test_case(test_roqoqo_1_12::operations::PauliY::new(0).into(); "PauliY")]
#[test_case(test_roqoqo_1_12::operations::PauliX::new(0).into(); "PauliX")]
#[test_case(test_roqoqo_1_12::operations::SqrtPauliX::new(0).into(); "SqrtPauliX")]
#[test_case(test_roqoqo_1_12::operations::InvSqrtPauliX::new(0).into(); "InvSqrtPauliX")]
#[test_case(test_roqoqo_1_12::operations::Hadamard::new(0).into(); "Hadamard")]
#[test_case(test_roqoqo_1_12::operations::TGate::new(0).into(); "TGate")]
#[test_case(test_roqoqo_1_12::operations::SGate::new(0).into(); "SGate")]
#[test_case(test_roqoqo_1_12::operations::DefinitionBit::new("ro".to_string(), 1, false).into(); "DefinitionBit")]
#[test_case(test_roqoqo_1_12::operations::DefinitionComplex::new("ro".to_string(), 1, true).into(); "DefinitionComplex")]
#[test_case(test_roqoqo_1_12::operations::DefinitionUsize::new("ro".to_string(), 1, true).into(); "DefinitionUsize")]
#[test_case(test_roqoqo_1_12::operations::DefinitionFloat::new("ro".to_string(), 1, true).into(); "DefinitionFloat")]
#[test_case(test_roqoqo_1_12::operations::InputSymbolic::new("ro".to_string(), 1.0).into(); "InputSymbolic")]
#[test_case(test_roqoqo_1_12::operations::MeasureQubit::new(0,"ro".to_string(), 1).into(); "MeasureQubit")]
#[test_case(test_roqoqo_1_12::operations::PragmaGetStateVector::new("ro".to_string(), None).into(); "PragmaGetStateVector")]
#[test_case(test_roqoqo_1_12::operations::PragmaGetDensityMatrix::new("ro".to_string(), None).into(); "PragmaGetDensityMatrix")]
#[test_case(test_roqoqo_1_12::operations::PragmaGetOccupationProbability::new("ro".to_string(), None).into(); "PragmaGetOccupationProbability")]
#[test_case(test_roqoqo_1_12::operations::PragmaGetPauliProduct::new(std::collections::HashMap::new(),"ro".to_string(), test_roqoqo_1_12::Circuit::new()).into(); "PragmaGetPauliProduct")]
#[test_case(test_roqoqo_1_12::operations::PragmaRepeatedMeasurement::new("ro".to_string(), 10, None).into(); "PragmaRepeatedMeasurement")]
#[test_case(test_roqoqo_1_12::operations::PragmaSetNumberOfMeasurements::new(10, "ro".to_string()).into(); "PragmaSetNumberOfMeasurements")]
#[test_case(test_roqoqo_1_12::operations::PragmaSetStateVector::new(ndarray::array![1.0.into(), 0.0.into(), 0.0.into()]).into(); "PragmaSetStateVector")]
#[test_case(test_roqoqo_1_12::operations::PragmaSetDensityMatrix::new(ndarray::array![[1.0.into(), 0.0.into(), 0.0.into()]]).into(); "PragmaSetDensityMatrix")]
#[test_case(test_roqoqo_1_12::operations::PragmaRepeatGate::new(10).into(); "PragmaRepeatGate")]
#[test_case(test_roqoqo_1_12::operations::PragmaOverrotation::new("RotateZ".to_string(), vec![0], 1.0, 1.0).into(); "PragmaOverrotation")]
#[test_case(test_roqoqo_1_12::operations::PragmaBoostNoise::new(1.0.into()).into(); "PragmaBoostNoise")]
#[test_case(test_roqoqo_1_12::operations::PragmaStopParallelBlock::new(vec![0], 1.0.into()).into(); "PragmaStopParallelBlock")]
#[test_case(test_roqoqo_1_12::operations::PragmaGlobalPhase::new(1.0.into()).into(); "PragmaGlobalPhase")]
#[test_case(test_roqoqo_1_12::operations::PragmaSleep::new(vec![0], 1.0.into()).into(); "PragmaSleep")]
#[test_case(test_roqoqo_1_12::operations::PragmaActiveReset::new(0).into(); "PragmaActiveReset")]
#[test_case(test_roqoqo_1_12::operations::PragmaStartDecompositionBlock::new(vec![0], HashMap::new()).into(); "PragmaStartDecompositionBlock")]
#[test_case(test_roqoqo_1_12::operations::PragmaStopDecompositionBlock::new(vec![0]).into(); "PragmaStopDecompositionBlock")]
#[test_case(test_roqoqo_1_12::operations::PragmaDamping::new(0,1.0.into(), 1.0.into()).into(); "PragmaDamping")]
#[test_case(test_roqoqo_1_12::operations::PragmaDepolarising::new(0,1.0.into(), 1.0.into()).into(); "PragmaDepolarising")]
#[test_case(test_roqoqo_1_12::operations::PragmaDephasing::new(0,1.0.into(), 1.0.into()).into(); "PragmaDephasing")]
#[test_case(test_roqoqo_1_12::operations::PragmaRandomNoise::new(0,1.0.into(), 1.0.into(), 1.0.into()).into(); "PragmaRandomNoise")]
#[test_case(test_roqoqo_1_12::operations::PragmaGeneralNoise::new(0, 0.1.into(), ndarray::array![[1.0.into(), 0.0.into()], [1.0.into(), 2.0.into()]]).into(); "PragmaGeneralNoise")]
#[test_case(test_roqoqo_1_12::operations::PragmaConditional::new("ro".to_string(),0, test_roqoqo_1_12::Circuit::new()).into(); "PragmaConditional")]
// #[test_case(test_roqoqo_1_12::operations::PragmaChangeDevice::new(&"PragmaTest".into()).unwrap().into(); "PragmaChangeDevice")]
#[test_case(test_roqoqo_1_12::operations::CNOT::new(0,1).into(); "CNOT")]
#[test_case(test_roqoqo_1_12::operations::SWAP::new(0,1).into(); "SWAP")]
#[test_case(test_roqoqo_1_12::operations::FSwap::new(0,1).into(); "FSwap")]
#[test_case(test_roqoqo_1_12::operations::ISwap::new(0,1).into(); "ISwap")]
#[test_case(test_roqoqo_1_12::operations::SqrtISwap::new(0,1).into(); "SqrtISWAP")]
#[test_case(test_roqoqo_1_12::operations::InvSqrtISwap::new(0,1).into(); "InvSqrtISWAP")]
#[test_case(test_roqoqo_1_12::operations::XY::new(0,1, 0.1.into()).into(); "XY")]
#[test_case(test_roqoqo_1_12::operations::ControlledPhaseShift::new(0,1, 0.1.into()).into(); "ControlledPhase")]
#[test_case(test_roqoqo_1_12::operations::ControlledPauliY::new(0,1).into(); "ControlledPauliY")]
#[test_case(test_roqoqo_1_12::operations::ControlledPauliZ::new(0,1).into(); "ControlledPauliZ")]
#[test_case(test_roqoqo_1_12::operations::MolmerSorensenXX::new(0,1).into(); "MolmerSorensenXX")]
#[test_case(test_roqoqo_1_12::operations::VariableMSXX::new(0,1, 0.1.into()).into(); "VariableMSXX")]
#[test_case(test_roqoqo_1_12::operations::GivensRotation::new(0,1, 0.1.into(), 0.1.into()).into(); "GivensRotation")]
#[test_case(test_roqoqo_1_12::operations::GivensRotationLittleEndian::new(0,1, 0.1.into(), 0.1.into()).into(); "GivensRotationLittleEndian")]
#[test_case(test_roqoqo_1_12::operations::Qsim::new(0,1, 0.1.into(), 0.1.into(), 0.1.into()).into(); "Qsim")]
#[test_case(test_roqoqo_1_12::operations::Fsim::new(0,1, 0.1.into(), 0.1.into(), 0.1.into()).into(); "Fsim")]
#[test_case(test_roqoqo_1_12::operations::SpinInteraction::new(0,1, 0.1.into(), 0.1.into(), 0.1.into()).into(); "SpinInteraction")]
#[test_case(test_roqoqo_1_12::operations::Bogoliubov::new(0,1, 0.1.into(), 0.1.into()).into(); "Bogoliubov")]
#[test_case(test_roqoqo_1_12::operations::PMInteraction::new(0,1, 0.1.into()).into(); "PMInteraction")]
#[test_case(test_roqoqo_1_12::operations::ComplexPMInteraction::new(0,1, 0.1.into(), 0.1.into()).into(); "ComplexPMInteraction")]
#[test_case(test_roqoqo_1_12::operations::PhaseShiftedControlledZ::new(0,1, 1.0.into()).into(); "PhaseShiftedControlledZ")]
#[test_case(test_roqoqo_1_12::operations::PhaseShiftState1::new(0, 1.0.into()).into(); "PhaseShiftState1")]
#[test_case(test_roqoqo_1_12::operations::PhaseShiftState0::new(0, 1.0.into()).into(); "PhaseShiftState0")]
#[test_case(test_roqoqo_1_12::operations::MultiQubitMS::new(vec![0,2,3], 1.0.into()).into(); "MultiQubitMS")]
#[test_case(test_roqoqo_1_12::operations::MultiQubitZZ::new(vec![0,2,3], 1.0.into()).into(); "MultiQubitZZ")]
// 1.1 and 1.2
#[test_case(test_roqoqo_1_12::operations::InputBit::new("input".to_string(), 1, true).into(); "InputBit")]
#[test_case(test_roqoqo_1_12::operations::PragmaLoop::new(2.0.into(), test_roqoqo_1_12::Circuit::new()).into(); "PragmaLoop")]
#[test_case(test_roqoqo_1_12::operations::PhaseShiftedControlledPhase::new(0,1, 1.0.into(), 1.0.into()).into(); "PhaseShiftedControlledPhase")]
// 1.3
#[test_case(test_roqoqo_1_12::operations::ControlledRotateX::new(0,1, 1.0.into()).into(); "ControlledRotateX")]
#[test_case(test_roqoqo_1_12::operations::ControlledRotateXY::new(0,1, 1.0.into(), 1.0.into()).into(); "ControlledRotateXY")]
#[test_case(test_roqoqo_1_12::operations::ControlledControlledPauliZ::new(0,1,2).into(); "ControlledControlledPauliZ")]
#[test_case(test_roqoqo_1_12::operations::ControlledControlledPhaseShift::new(0,1,2, 1.0.into()).into(); "ControlledControlledPhaseShift")]
#[test_case(test_roqoqo_1_12::operations::Toffoli::new(0,1,2).into(); "Toffoli")]
// 1.4
#[test_case(test_roqoqo_1_12::operations::GPi::new(0, 0.1.into()).into(); "GPi")]
#[test_case(test_roqoqo_1_12::operations::GPi2::new(0, 0.1.into()).into(); "GPi2")]
// 1.5
#[test_case(test_roqoqo_1_12::operations::PragmaControlledCircuit::new(0, test_roqoqo_1_12::Circuit::new()).into(); "PragmaControlledCircuit")]
// Operations from 1.6
#[test_case(test_roqoqo_1_12::operations::Squeezing::new(0, 0.1.into(), 0.1.into()).into(); "Squeezing")]
#[test_case(test_roqoqo_1_12::operations::PhaseShift::new(0, 0.1.into()).into(); "PhaseShift")]
#[test_case(test_roqoqo_1_12::operations::BeamSplitter::new(0, 1, 0.1.into(), 0.2.into()).into(); "BeamSplitter")]
#[test_case(test_roqoqo_1_12::operations::PhotonDetection::new(0, "ro".into(), 0).into(); "PhotonDetection")]
// Operations from 1.7
#[test_case(test_roqoqo_1_12::operations::Identity::new(0).into(); "Identity")]
// Operations from 1.8
#[test_case(test_roqoqo_1_12::operations::PhaseDisplacement::new(0, 0.1.into(), 0.1.into()).into(); "PhaseDisplacement")]
#[test_case(test_roqoqo_1_12::operations::EchoCrossResonance::new(0, 1).into(); "EchoCrossResonance")]
#[test_case(test_roqoqo_1_12::operations::PragmaAnnotatedOp::new(test_roqoqo_1_12::operations::PauliX::new(0).into(), "test".to_string()).into(); "PragmaAnnotatedOp")]
// Operations from 1.9 - nothing was added
// Operations from 1.10
// QuantumRabi, LongitudinalCoupling, JaynesCummings, SingleExcitationLoad, SingleExcitationStore and CZQubitResonator were all added
// as unstable, but have been added as stable in 1.11
// Operations from 1.11
#[test_case(test_roqoqo_1_12::operations::QuantumRabi::new(0, 1, 0.1.into()).into(); "QuantumRabi")]
#[test_case(test_roqoqo_1_12::operations::LongitudinalCoupling::new(0, 1, 0.1.into()).into(); "LongitudinalCoupling")]
#[test_case(test_roqoqo_1_12::operations::JaynesCummings::new(0, 1, 0.1.into()).into(); "JaynesCummings")]
#[test_case(test_roqoqo_1_12::operations::SingleExcitationLoad::new(0, 1).into(); "SingleExcitationLoad")]
#[test_case(test_roqoqo_1_12::operations::SingleExcitationStore::new(0, 1).into(); "SingleExcitationStore")]
#[test_case(test_roqoqo_1_12::operations::CZQubitResonator::new(0, 1).into(); "CZQubitResonator")]
// Operations from 1.11 - ApplyConstantSpinHamiltonian and ApplyTimeDependentHamiltonian are unstable in 1.11
// #[test_case(create_apply_constant_spin_hamiltonian(); "ApplyConstantSpinHamiltonian")]
// #[test_case(create_apply_timedependent_spin_hamiltonian(); "ApplyTimeDependentHamiltonian")]
// Operations from 1.13 - GateDefinition and CallDefined gate are unstable, uncomment when stable.
// #[test_case(test_roqoqo_1_12::operations::GateDefinition::new(test_roqoqo_1_12::Circuit::new(), "name".into(), vec![0, 1], vec!["param".into()]).into(); "GateDefinition")]
// #[test_case(test_roqoqo_1_12::operations::CallDefinedGate::new("name".into(), vec![0, 1], vec![0.0]).into(); "CallDefinedGate")]
fn test_bincode_compatibility_1_12(operation: test_roqoqo_1_12::operations::Operation) {
let mut test_circuit = test_roqoqo_1_12::Circuit::new();
test_circuit += operation;

let test_measurement_input = test_roqoqo_1_12::measurements::PauliZProductInput::new(3, false);
let test_measurement = test_roqoqo_1_12::measurements::PauliZProduct {
constant_circuit: Some(test_circuit.clone()),
circuits: vec![test_circuit],
input: test_measurement_input,
};
let test_program = test_roqoqo_1_12::QuantumProgram::PauliZProduct {
measurement: test_measurement,
input_parameter_names: vec!["test".to_string()],
};
let test_serialisation: Vec<u8> = bincode::serialize(&test_program).unwrap();

let _test_deserialisation: roqoqo::QuantumProgram =
bincode::deserialize(&test_serialisation).unwrap();
}

#[test]
fn test_device_compat() {
let test_device = test_roqoqo_1_12::devices::AllToAllDevice::new(
3,
&["RotateZ".to_string()],
&["CNOT".to_string()],
1.0,
);
let test_serialisation: Vec<u8> = bincode::serialize(&test_device).unwrap();

let test_deserialisation: roqoqo::devices::AllToAllDevice =
bincode::deserialize(&test_serialisation).unwrap();

let comparsion_device = roqoqo::devices::AllToAllDevice::new(
3,
&["RotateZ".to_string()],
&["CNOT".to_string()],
1.0,
);
assert_eq!(test_deserialisation, comparsion_device);
}

// Operations from 1.11 - ApplyConstantSpinHamiltonian and ApplyTimeDependentHamiltonian are unstable in 1.11
// use struqture;
// use struqture::prelude::*;
// fn create_apply_constant_spin_hamiltonian(
// ) -> test_roqoqo_1_12::operations::ApplyConstantSpinHamiltonian {
// let pp = struqture::spins::PauliProduct::new().z(0);
// let mut hamiltonian = struqture::spins::SpinHamiltonian::new();
// hamiltonian
// .add_operator_product(pp.clone(), 1.0.into())
// .unwrap();
// return test_roqoqo_1_12::operations::ApplyConstantSpinHamiltonian::new(
// hamiltonian,
// 1.0.into(),
// );
// }

// fn create_apply_timedependent_spin_hamiltonian(
// ) -> test_roqoqo_1_12::operations::ApplyTimeDependentSpinHamiltonian {
// let pp = struqture::spins::PauliProduct::new().z(0);
// let mut hamiltonian = struqture::spins::SpinHamiltonian::new();
// hamiltonian
// .add_operator_product(pp.clone(), "omega".into())
// .unwrap();
// let mut values = HashMap::new();
// values.insert("omega".to_string(), vec![1.0]);
// return test_roqoqo_1_12::operations::ApplyTimeDependentSpinHamiltonian::new(
// hamiltonian,
// vec![1.0],
// values.clone(),
// );
// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright © 2021-2023 HQS Quantum Simulations GmbH. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing permissions and
// limitations under the License.
#[cfg(test)]
mod compatibility_1_12;
Loading

0 comments on commit cdf58c2

Please sign in to comment.