Function quest_bind::apply_diagonal_op
source · pub fn apply_diagonal_op(
qureg: &mut Qureg<'_>,
op: &DiagonalOp<'_>
) -> Result<(), QuestError>
Expand description
Apply a diagonal operator to the entire qureg
.
Examples
let env = &QuestEnv::new();
let qureg =
&mut Qureg::try_new(2, &env).expect("cannot allocate memory for Qureg");
let op = &mut DiagonalOp::try_new(2, env).unwrap();
init_diagonal_op(op, &[1., 2., 3., 4.], &[5., 6., 7., 8.]).unwrap();
apply_diagonal_op(qureg, &op).unwrap();
See QuEST API for more information.