Function quest_bind::calc_density_inner_product
source · pub fn calc_density_inner_product(
rho1: &Qureg<'_>,
rho2: &Qureg<'_>
) -> Result<Qreal, QuestError>
Expand description
Computes the Hilbert-Schmidt scalar product.
Examples
let env = QuestEnv::new();
let qureg = Qureg::try_new_density(2, &env)
.expect("cannot allocate memory for Qureg");
let other_qureg = {
let mut other_qureg = Qureg::try_new_density(2, &env)
.expect("cannot allocate memory for Qureg");
other_qureg.init_plus_state();
other_qureg
};
let prod = calc_density_inner_product(&qureg, &other_qureg).unwrap();
assert!((prod - 0.25).abs() < EPSILON);
See QuEST API for more information.