The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches

Functions for calculating single-state properties like normalisation and purity. More...

Functions

qreal calcPurity (Qureg qureg)
 
qreal calcTotalProb (Qureg qureg)
 

Detailed Description

Functions for calculating single-state properties like normalisation and purity.

Function Documentation

◆ calcPurity()

qreal calcPurity ( Qureg qureg)
Note
Documentation for this function or struct is under construction!
Attention
This function's input validation has not yet been tested, so erroneous usage may produce unexpected output. Please use with caution!

Definition at line 288 of file calculations.cpp.

288 {
289 validate_quregFields(qureg, __func__);
290
291 // assuming Hermiticity, Tr(rho^2) = sum_ij |rho_ij|^2,
292 // and Tr(|x><x|x><x|) = (sum_i |x_i|^2)^2
293 qreal prob = localiser_statevec_calcTotalProb(qureg);
294 return (qureg.isDensityMatrix)? prob : prob * prob;
295}

Referenced by TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().

◆ calcTotalProb()

qreal calcTotalProb ( Qureg qureg)
Note
Documentation for this function or struct is under construction!
Attention
This function's input validation has not yet been tested, so erroneous usage may produce unexpected output. Please use with caution!

Definition at line 273 of file calculations.cpp.

273 {
274 validate_quregFields(qureg, __func__);
275
276 return (qureg.isDensityMatrix)?
277 localiser_densmatr_calcTotalProb(qureg):
278 localiser_statevec_calcTotalProb(qureg);
279}

Referenced by setQuregToRenormalized(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().