pub fn init_diagonal_op_from_pauli_hamil(
    op: &mut DiagonalOp<'_>,
    hamil: &PauliHamil
) -> Result<(), QuestError>
Expand description

Populates the diagonal operator \p op to be equivalent to the given Pauli Hamiltonian

Assuming hamil contains only PAULI_I or PAULI_Z operators.

Examples

use quest_bind::PauliOpType::*;

let hamil = &mut PauliHamil::try_new(2, 2).unwrap();
init_pauli_hamil(
    hamil,
    &[0.5, -0.5],
    &[PAULI_I, PAULI_Z, PAULI_Z, PAULI_Z],
)
.unwrap();

let env = &QuestEnv::new();
let mut op = &mut DiagonalOp::try_new(2, env).unwrap();

init_diagonal_op_from_pauli_hamil(op, hamil).unwrap();

See QuEST API for more information.