<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- For Mobile Devices -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<title>QuEST: Calculations</title>
<!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css"/>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="jquery.smartmenus.js"></script>
<!-- SmartMenus jQuery Bootstrap Addon -->
<script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
<!-- SmartMenus jQuery plugin -->
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand"><img alt="Logo" src="logo.png"/></a>
<a class="navbar-brand"><b>QuEST</b> v3.4.0<br>The Quantum Exact Simulation Toolkit</a>
</div>
</div>
</nav>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div class="content" id="content">
<div class="container">
<div class="row">
<div class="col-sm-12 panel " style="padding-bottom: 15px;">
<div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Calculations</div> </div>
</div><!--header-->
<div class="contents">
<p>Calculations and property-getters which do not modify the studied quantum state.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga658b3a5cab5e73a17a7fd76a83583a22"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga658b3a5cab5e73a17a7fd76a83583a22">calcDensityInnerProduct</a> (<a class="el" href="structQureg.html">Qureg</a> rho1, <a class="el" href="structQureg.html">Qureg</a> rho2)</td></tr>
<tr class="memdesc:ga658b3a5cab5e73a17a7fd76a83583a22"><td class="mdescLeft"> </td><td class="mdescRight">Computes the Hilbert-Schmidt scalar product (which is equivalent to the Frobenius inner product of matrices) of two density matrices <code>rho1</code> and <code>rho2</code> of equivalent size. <a href="group__calc.html#ga658b3a5cab5e73a17a7fd76a83583a22">More...</a><br /></td></tr>
<tr class="separator:ga658b3a5cab5e73a17a7fd76a83583a22"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga82f17e96a4cb7612fb9c6ef856df3810"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structComplex.html">Complex</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810">calcExpecDiagonalOp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structDiagonalOp.html">DiagonalOp</a> op)</td></tr>
<tr class="memdesc:ga82f17e96a4cb7612fb9c6ef856df3810"><td class="mdescLeft"> </td><td class="mdescRight">Computes the expected value of the diagonal operator <code>op</code> for state <code>qureg</code>. <a href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810">More...</a><br /></td></tr>
<tr class="separator:ga82f17e96a4cb7612fb9c6ef856df3810"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga5544d2833a69941b8820797b79daf79f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga5544d2833a69941b8820797b79daf79f">calcExpecPauliHamil</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structPauliHamil.html">PauliHamil</a> hamil, <a class="el" href="structQureg.html">Qureg</a> workspace)</td></tr>
<tr class="memdesc:ga5544d2833a69941b8820797b79daf79f"><td class="mdescLeft"> </td><td class="mdescRight">Computes the expected value of <code>qureg</code> under Hermitian operator <code>hamil</code>. <a href="group__calc.html#ga5544d2833a69941b8820797b79daf79f">More...</a><br /></td></tr>
<tr class="separator:ga5544d2833a69941b8820797b79daf79f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga15cfad3f3d26339128e3be32ae7deacd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd">calcExpecPauliProd</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *targetQubits, enum <a class="el" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a> *pauliCodes, int numTargets, <a class="el" href="structQureg.html">Qureg</a> workspace)</td></tr>
<tr class="memdesc:ga15cfad3f3d26339128e3be32ae7deacd"><td class="mdescLeft"> </td><td class="mdescRight">Computes the expected value of a product of Pauli operators. <a href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd">More...</a><br /></td></tr>
<tr class="separator:ga15cfad3f3d26339128e3be32ae7deacd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga50ee589fd5ceab52fdd70d0082352b41"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41">calcExpecPauliSum</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, enum <a class="el" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a> *allPauliCodes, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> *termCoeffs, int numSumTerms, <a class="el" href="structQureg.html">Qureg</a> workspace)</td></tr>
<tr class="memdesc:ga50ee589fd5ceab52fdd70d0082352b41"><td class="mdescLeft"> </td><td class="mdescRight">Computes the expected value of a sum of products of Pauli operators. <a href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41">More...</a><br /></td></tr>
<tr class="separator:ga50ee589fd5ceab52fdd70d0082352b41"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa266ed6c8ae5d0d0f49e1ac50819cffc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#gaa266ed6c8ae5d0d0f49e1ac50819cffc">calcFidelity</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structQureg.html">Qureg</a> pureState)</td></tr>
<tr class="memdesc:gaa266ed6c8ae5d0d0f49e1ac50819cffc"><td class="mdescLeft"> </td><td class="mdescRight">Calculates the fidelity of <code>qureg</code> (a state-vector or density matrix) against a reference pure state (necessarily a state-vector). <a href="group__calc.html#gaa266ed6c8ae5d0d0f49e1ac50819cffc">More...</a><br /></td></tr>
<tr class="separator:gaa266ed6c8ae5d0d0f49e1ac50819cffc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga87ddbe5c8281543541ccd99e0dafd387"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387">calcHilbertSchmidtDistance</a> (<a class="el" href="structQureg.html">Qureg</a> a, <a class="el" href="structQureg.html">Qureg</a> b)</td></tr>
<tr class="memdesc:ga87ddbe5c8281543541ccd99e0dafd387"><td class="mdescLeft"> </td><td class="mdescRight">Computes the Hilbert Schmidt distance between two density matrices <code>a</code> and <code>b</code>, defined as the Frobenius norm of the difference between them. <a href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387">More...</a><br /></td></tr>
<tr class="separator:ga87ddbe5c8281543541ccd99e0dafd387"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga374ad70804998394ae41ebfe106258a6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structComplex.html">Complex</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga374ad70804998394ae41ebfe106258a6">calcInnerProduct</a> (<a class="el" href="structQureg.html">Qureg</a> bra, <a class="el" href="structQureg.html">Qureg</a> ket)</td></tr>
<tr class="memdesc:ga374ad70804998394ae41ebfe106258a6"><td class="mdescLeft"> </td><td class="mdescRight">Computes the inner product <img class="formulaInl" alt="$ \langle \text{bra} | \text{ket} \rangle $" src="form_146.png"/> of two equal-size state vectors, given by. <a href="group__calc.html#ga374ad70804998394ae41ebfe106258a6">More...</a><br /></td></tr>
<tr class="separator:ga374ad70804998394ae41ebfe106258a6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad0cc08d52cad5062553d6f78126780cc"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#gad0cc08d52cad5062553d6f78126780cc">calcProbOfAllOutcomes</a> (<a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> *outcomeProbs, <a class="el" href="structQureg.html">Qureg</a> qureg, int *qubits, int numQubits)</td></tr>
<tr class="memdesc:gad0cc08d52cad5062553d6f78126780cc"><td class="mdescLeft"> </td><td class="mdescRight">Populates <code>outcomeProbs</code> with the probabilities of every outcome of the sub-register contained in <code>qubits</code>. <a href="group__calc.html#gad0cc08d52cad5062553d6f78126780cc">More...</a><br /></td></tr>
<tr class="separator:gad0cc08d52cad5062553d6f78126780cc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga2a7946e6fa4f44c9ae0c6c9f683229ad"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga2a7946e6fa4f44c9ae0c6c9f683229ad">calcProbOfOutcome</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int measureQubit, int outcome)</td></tr>
<tr class="memdesc:ga2a7946e6fa4f44c9ae0c6c9f683229ad"><td class="mdescLeft"> </td><td class="mdescRight">Gives the probability of a specified qubit being measured in the given outcome (0 or 1). <a href="group__calc.html#ga2a7946e6fa4f44c9ae0c6c9f683229ad">More...</a><br /></td></tr>
<tr class="separator:ga2a7946e6fa4f44c9ae0c6c9f683229ad"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga683779343fb2c6055f6b1d01079c2ede"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga683779343fb2c6055f6b1d01079c2ede">calcPurity</a> (<a class="el" href="structQureg.html">Qureg</a> qureg)</td></tr>
<tr class="memdesc:ga683779343fb2c6055f6b1d01079c2ede"><td class="mdescLeft"> </td><td class="mdescRight">Calculates the purity of a density matrix, by the trace of the density matrix squared. <a href="group__calc.html#ga683779343fb2c6055f6b1d01079c2ede">More...</a><br /></td></tr>
<tr class="separator:ga683779343fb2c6055f6b1d01079c2ede"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab082910d33473ec29e1d5852943de468"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#gab082910d33473ec29e1d5852943de468">calcTotalProb</a> (<a class="el" href="structQureg.html">Qureg</a> qureg)</td></tr>
<tr class="memdesc:gab082910d33473ec29e1d5852943de468"><td class="mdescLeft"> </td><td class="mdescRight">A debugging function which calculates the probability of the qubits in <code>qureg</code> being in any state, which should always be 1 for correctly normalised states (hence returning a real number). <a href="group__calc.html#gab082910d33473ec29e1d5852943de468">More...</a><br /></td></tr>
<tr class="separator:gab082910d33473ec29e1d5852943de468"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga30d6f8b7c766c9c9914b2c61a2fc0def"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structComplex.html">Complex</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def">getAmp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int index)</td></tr>
<tr class="memdesc:ga30d6f8b7c766c9c9914b2c61a2fc0def"><td class="mdescLeft"> </td><td class="mdescRight">Get the complex amplitude at a given index in the state vector. <a href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def">More...</a><br /></td></tr>
<tr class="separator:ga30d6f8b7c766c9c9914b2c61a2fc0def"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gadca286c4ad5cde6124d4e80a7ab95a68"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structComplex.html">Complex</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68">getDensityAmp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int row, long long int col)</td></tr>
<tr class="memdesc:gadca286c4ad5cde6124d4e80a7ab95a68"><td class="mdescLeft"> </td><td class="mdescRight">Get an amplitude from a density matrix at a given row and column. <a href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68">More...</a><br /></td></tr>
<tr class="separator:gadca286c4ad5cde6124d4e80a7ab95a68"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad575782de461d9ab0975b38cc7850f1a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a">getImagAmp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int index)</td></tr>
<tr class="memdesc:gad575782de461d9ab0975b38cc7850f1a"><td class="mdescLeft"> </td><td class="mdescRight">Get the imaginary component of the complex probability amplitude at an index in the state vector. <a href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a">More...</a><br /></td></tr>
<tr class="separator:gad575782de461d9ab0975b38cc7850f1a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8cbe422d4981bf06847d229a4c6aa3df"><td class="memItemLeft" align="right" valign="top">long long int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df">getNumAmps</a> (<a class="el" href="structQureg.html">Qureg</a> qureg)</td></tr>
<tr class="memdesc:ga8cbe422d4981bf06847d229a4c6aa3df"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of complex amplitudes in a state-vector <code>qureg</code>. <a href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df">More...</a><br /></td></tr>
<tr class="separator:ga8cbe422d4981bf06847d229a4c6aa3df"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga73036c778d800703585ab3d8796a915f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga73036c778d800703585ab3d8796a915f">getNumQubits</a> (<a class="el" href="structQureg.html">Qureg</a> qureg)</td></tr>
<tr class="memdesc:ga73036c778d800703585ab3d8796a915f"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of qubits represented by <code>qureg</code>. <a href="group__calc.html#ga73036c778d800703585ab3d8796a915f">More...</a><br /></td></tr>
<tr class="separator:ga73036c778d800703585ab3d8796a915f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4a14d22379d399760b0cfc5c8053589b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b">getProbAmp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int index)</td></tr>
<tr class="memdesc:ga4a14d22379d399760b0cfc5c8053589b"><td class="mdescLeft"> </td><td class="mdescRight">Get the probability of a state-vector at an index in the full state vector. <a href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b">More...</a><br /></td></tr>
<tr class="separator:ga4a14d22379d399760b0cfc5c8053589b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1416145280c62c5dd5ec9bed89b4cd05"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05">getRealAmp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int index)</td></tr>
<tr class="memdesc:ga1416145280c62c5dd5ec9bed89b4cd05"><td class="mdescLeft"> </td><td class="mdescRight">Get the real component of the complex probability amplitude at an index in the state vector. <a href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05">More...</a><br /></td></tr>
<tr class="separator:ga1416145280c62c5dd5ec9bed89b4cd05"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Calculations and property-getters which do not modify the studied quantum state. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga658b3a5cab5e73a17a7fd76a83583a22"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga658b3a5cab5e73a17a7fd76a83583a22">◆ </a></span>calcDensityInnerProduct()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcDensityInnerProduct </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>rho1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>rho2</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the Hilbert-Schmidt scalar product (which is equivalent to the Frobenius inner product of matrices) of two density matrices <code>rho1</code> and <code>rho2</code> of equivalent size. </p>
<p>That is, we define the Hilbert-Schmidt scalar product </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ ((\rho_1, \rho_2))_{HS} := \text{Tr}[ \rho_1^\dagger \rho_2 ], \]" src="form_148.png"/>
</p>
<p> which is equivalent to the sum of products of matrix elemets, i.e., </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ ((\rho_1, \rho_2))_{HS} = \sum\limits_i \sum\limits_j (\rho_1)_{ij}^* (\rho_2)_{ij} \]" src="form_149.png"/>
</p>
<p> Assuming that both density matrices are Hermitian, the resulting scalar product is real and invariant under reordering its arguments as </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ ((\rho_1, \rho_2))_{HS} = ((\rho_2, \rho_1))_{HS} = \text{Tr}[\rho_1 \rho_2] \]" src="form_150.png"/>
</p>
<p> If both <code>rho1</code> and <code>rho2</code> are density matrices of pure states <code>bra</code> and <code>ket</code>, then the equality holds </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ ((\rho_1, \rho_2))_{HS} = |\langle \text{bra} | \text{ket} \rangle|^2. \]" src="form_151.png"/>
</p>
<p> If either or both of <code>rho1</code> and <code>rho2</code> are non Hermitian (i.e. invalid density matrices), then this function returns the real component of the scalar product, and discards the imaginary component. That is, it returns </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \text{Re}\{ \text{Tr}[ \rho_1^\dagger \rho_2 ] \} = \text{Re}\{ \text{Tr}[ \rho_2^\dagger \rho_1 ] \}. \]" src="form_152.png"/>
</p>
<p> This is still sometimes useful, e.g. in calculating the inner product with an anti-commutator, e.g. (for Hermitian <img class="formulaInl" alt="$ \sigma $" src="form_153.png"/>, <img class="formulaInl" alt="$ \rho $" src="form_47.png"/>, <img class="formulaInl" alt="$ H $" src="form_154.png"/>) </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ ((\sigma, H \rho + \rho H))_{HS} = 2 \; \text{Re} \{ ((\sigma, H \rho))_{HS} \} \]" src="form_155.png"/>
</p>
<p> where <img class="formulaInl" alt="$ H \rho $" src="form_156.png"/> could be a weighted sum of Pauli products applied to <img class="formulaInl" alt="$ \rho $" src="form_47.png"/> through <a class="el" href="group__operator.html#ga6fc26cf857db070e12959e59ecfed8a6" title="Modifies outQureg to be the result of applying the weighted sum of Pauli products (a Hermitian but no...">applyPauliSum()</a>.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga374ad70804998394ae41ebfe106258a6" title="Computes the inner product of two equal-size state vectors, given by.">calcInnerProduct()</a></li>
<li><a class="el" href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387" title="Computes the Hilbert Schmidt distance between two density matrices a and b, defined as the Frobenius ...">calcHilbertSchmidtDistance()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">rho1</td><td>qureg as a density matrix (to have its values conjugate transposed) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">rho2</td><td>qureg as a density matrix </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the real Hilbert-Schmidt scalar product of density matrices <code>rho1</code> and <code>rho2</code> (assuming Hermiticity) </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>rho1</code> and <code>rho2</code> are not both density matrices</li>
<li>if <code>rho1</code> and <code>rho2</code> have mismatching dimensions </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Balint Koczor (CPU) </dd>
<dd>
Tyson Jones (GPU) </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01158">1158</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>  {</div>
<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>  <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(rho1, __func__);</div>
<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>  <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(rho2, __func__);</div>
<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>  <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(rho1, rho2, __func__);</div>
<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>  </div>
<div class="line"><a name="l01163"></a><span class="lineno"> 1163</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a6ff3dc624b5fafe8edae4fe327c255a0">densmatr_calcInnerProduct</a>(rho1, rho2);</div>
<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00455">densmatr_calcInnerProduct()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00519">validateDensityMatrQureg()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00531">validateMatchingQuregDims()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00021">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga82f17e96a4cb7612fb9c6ef856df3810"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga82f17e96a4cb7612fb9c6ef856df3810">◆ </a></span>calcExpecDiagonalOp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structComplex.html">Complex</a> calcExpecDiagonalOp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structDiagonalOp.html">DiagonalOp</a> </td>
<td class="paramname"><em>op</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the expected value of the diagonal operator <code>op</code> for state <code>qureg</code>. </p>
<p>Since <code>op</code> is not necessarily Hermitian, the expected value may be a complex number.</p>
<p>Let <img class="formulaInl" alt="$ D $" src="form_43.png"/> be the diagonal operator <code>op</code>, with diagonal elements <img class="formulaInl" alt="$ d_i $" src="form_44.png"/>. Then if <code>qureg</code> is a state-vector <img class="formulaInl" alt="$|\psi\rangle $" src="form_45.png"/>, this function computes </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \langle \psi | D | \psi \rangle = \sum_i |\psi_i|^2 \, d_i \]" src="form_46.png"/>
</p>
<p> If <code>qureg</code> is a density matrix <img class="formulaInl" alt="$ \rho $" src="form_47.png"/>, this function computes </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \text{Trace}( D \rho ) = \sum_i \rho_{ii} \, d_i \]" src="form_48.png"/>
</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__type.html#gaebf896dd8d5eeaf9fd896f6cc8e334fe" title="Creates a DiagonalOp representing a diagonal operator on the full Hilbert space of a Qureg.">createDiagonalOp()</a></li>
<li><a class="el" href="group__operator.html#gad2e953390342cd361cfb4064d47715e6" title="Apply a diagonal operator, which is possibly non-unitary and non-Hermitian, to the entire qureg.">applyDiagonalOp()</a></li>
<li><a class="el" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41" title="Computes the expected value of a sum of products of Pauli operators.">calcExpecPauliSum()</a></li>
<li><a class="el" href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd" title="Computes the expected value of a product of Pauli operators.">calcExpecPauliProd()</a></li>
<li><a class="el" href="group__calc.html#ga5544d2833a69941b8820797b79daf79f" title="Computes the expected value of qureg under Hermitian operator hamil.">calcExpecPauliHamil()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>a state-vector or density matrix </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">op</td><td>the diagonal operator to compute the expected value of </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the expected vaulue of the operator </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>op</code> was not created</li>
<li>if <code>op</code> acts on a different number of qubits than <code>qureg</code> represents </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01228">1228</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>  {</div>
<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>  <a class="code" href="QuEST__validation_8c.html#a8a656a83bf0b44447188d06c2f8114cb">validateDiagonalOp</a>(qureg, op, __func__);</div>
<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>  </div>
<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>  <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a70e3b0a2297c186d5c779af31459b4ca">densmatr_calcExpecDiagonalOp</a>(qureg, op);</div>
<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a0fb948ddab4ca210e523aa3c52639df4">statevec_calcExpecDiagonalOp</a>(qureg, op);</div>
<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01618">densmatr_calcExpecDiagonalOp()</a>, <a class="el" href="QuEST_8h_source.html#l00325">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01600">statevec_calcExpecDiagonalOp()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00713">validateDiagonalOp()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00117">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga5544d2833a69941b8820797b79daf79f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5544d2833a69941b8820797b79daf79f">◆ </a></span>calcExpecPauliHamil()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcExpecPauliHamil </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structPauliHamil.html">PauliHamil</a> </td>
<td class="paramname"><em>hamil</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>workspace</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the expected value of <code>qureg</code> under Hermitian operator <code>hamil</code>. </p>
<p>Represent <code>hamil</code> as <img class="formulaInl" alt="$ H = \sum_i c_i \otimes_j^{N} \hat{\sigma}_{i,j} $" src="form_202.png"/> (where <img class="formulaInl" alt="$ c_i \in $" src="form_203.png"/> <code>hamil.termCoeffs</code> and <img class="formulaInl" alt="$ N = $" src="form_204.png"/> <code>hamil.numQubits</code>). This function computes <img class="formulaInl" alt="$ \langle \psi | H | \psi \rangle $" src="form_205.png"/> if <code>qureg</code> = <img class="formulaInl" alt="$ \psi $" src="form_85.png"/> is a state-vector, and computes <img class="formulaInl" alt="$ \text{Trace}(H \rho) =\text{Trace}(\rho H) $" src="form_206.png"/> if <code>qureg</code> = <img class="formulaInl" alt="$ \rho $" src="form_47.png"/> is a density matrix.</p>
<p>This function is merely an encapsulation of <a class="el" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41" title="Computes the expected value of a sum of products of Pauli operators.">calcExpecPauliSum()</a> - refer to the doc there for an elaboration.</p>
<p><code>workspace</code> must be a register with the same type (state-vector vs density matrix) and dimensions (number of represented qubits) as <code>qureg</code> and <code>hamil</code>, and is used as working space. When this function returns, <code>qureg</code> will be unchanged and <code>workspace</code> will be set to <code>qureg</code> pre-multiplied with the final Pauli product in <code>hamil</code>. NOTE that if <code>qureg</code> is a density matrix, <code>workspace</code> will become <img class="formulaInl" alt="$ \hat{\sigma} \rho $" src="form_208.png"/> which is itself not a density matrix (it is distinct from <img class="formulaInl" alt="$ \hat{\sigma} \rho \hat{\sigma}^\dagger $" src="form_209.png"/>).</p>
<p>This function works by cloning the <code>qureg</code> state into <code>workspace</code>, applying each of the specified Pauli products in <code>hamil</code> to <code>workspace</code> (one Pauli operation at a time), then computing its inner product with <code>qureg</code> (for state-vectors) or its trace (for density matrices) multiplied with the corresponding coefficient, and summing these contributions. It therefore should scale linearly in time with the total number of non-identity specified Pauli operators.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__type.html#ga35b28710877c462927366fa602e591cb" title="Dynamically allocates a Hamiltonian expressed as a real-weighted sum of products of Pauli operators.">createPauliHamil()</a></li>
<li><a class="el" href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810" title="Computes the expected value of the diagonal operator op for state qureg.">calcExpecDiagonalOp()</a></li>
<li><a class="el" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41" title="Computes the expected value of a sum of products of Pauli operators.">calcExpecPauliSum()</a></li>
<li><a class="el" href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd" title="Computes the expected value of a product of Pauli operators.">calcExpecPauliProd()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>the register of which to find the expected value, which is unchanged by this function </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">hamil</td><td>a <code><a class="el" href="structPauliHamil.html" title="A Pauli Hamiltonian, expressed as a real-weighted sum of pauli products, and which can hence represen...">PauliHamil</a></code> created with <a class="el" href="group__type.html#ga35b28710877c462927366fa602e591cb" title="Dynamically allocates a Hamiltonian expressed as a real-weighted sum of products of Pauli operators.">createPauliHamil()</a> or <a class="el" href="group__type.html#gaa77376c5e3518186eb085f37826d6008" title="Creates a PauliHamil instance, a real-weighted sum of products of Pauli operators,...">createPauliHamilFromFile()</a> </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">workspace</td><td>a working-space qureg with the same dimensions as <code>qureg</code>, which is modified to be the result of multiplying the state with the final specified Pauli product </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if any code in <code>hamil.pauliCodes</code> is not a valid Pauli code</li>
<li>if <code>hamil.numSumTerms</code> <= 0</li>
<li>if <code>workspace</code> is not of the same type and dimensions as <code>qureg</code> and <code>hamil</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01219">1219</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>  {</div>
<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>  <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>  <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>  <a class="code" href="QuEST__validation_8c.html#a066b0c4d0b02a0f3b9be7e5c68d9de6a">validatePauliHamil</a>(hamil, __func__);</div>
<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>  <a class="code" href="QuEST__validation_8c.html#a2b88b068a8242ee28da42c7324cdd078">validateMatchingQuregPauliHamilDims</a>(qureg, hamil, __func__);</div>
<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>  </div>
<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#ae0cfea24091c8336146aa84c2253992e">statevec_calcExpecPauliSum</a>(qureg, hamil.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>, hamil.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>, hamil.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a>, workspace);</div>
<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00285">PauliHamil::numSumTerms</a>, <a class="el" href="QuEST_8h_source.html#l00281">PauliHamil::pauliCodes</a>, <a class="el" href="QuEST__common_8c_source.html#l00524">statevec_calcExpecPauliSum()</a>, <a class="el" href="QuEST_8h_source.html#l00283">PauliHamil::termCoeffs</a>, <a class="el" href="QuEST__validation_8c_source.html#l00531">validateMatchingQuregDims()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00660">validateMatchingQuregPauliHamilDims()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00535">validateMatchingQuregTypes()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00655">validatePauliHamil()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00189">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga15cfad3f3d26339128e3be32ae7deacd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga15cfad3f3d26339128e3be32ae7deacd">◆ </a></span>calcExpecPauliProd()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcExpecPauliProd </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>targetQubits</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">enum <a class="el" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a> * </td>
<td class="paramname"><em>pauliCodes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>numTargets</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>workspace</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the expected value of a product of Pauli operators. </p>
<p>Letting <img class="formulaInl" alt="$ \sigma = \otimes_j \hat{\sigma}_j $" src="form_195.png"/> be the operators indicated by <code>pauliCodes</code> and acting on qubits <code>targetQubits</code>, this function computes <img class="formulaInl" alt="$ \langle \psi | \sigma | \psi \rangle $" src="form_196.png"/> if <code>qureg</code> = <img class="formulaInl" alt="$ \psi $" src="form_85.png"/> is a state-vector, and computes <img class="formulaInl" alt="$ \text{Trace}(\sigma \rho) $" src="form_197.png"/> if <code>qureg</code> = <img class="formulaInl" alt="$ \rho $" src="form_47.png"/> is a density matrix.</p>
<p><code>pauliCodes</code> is an array of length <code>numTargets</code> which specifies which Pauli operators to enact on the corresponding qubits in <code>targetQubits</code>, where 0 = <code>PAULI_I</code>, 1 = <code>PAULI_X</code>, 2 = <code>PAULI_Y</code>, 3 = <code>PAULI_Z</code>. The target qubits must be unique, and at most <code>qureg.numQubitsRepresented</code> may be specified. For example, on a 7-qubit state-vector, </p><div class="fragment"><div class="line"><a class="code" href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd">calcExpecPauliProd</a>(qureg, {4,5,6}, {<a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a7abac7bb5b71e17382014c443244ad5c">PAULI_X</a>, <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a">PAULI_I</a>, <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a085c85cff6ba79c52d8b1e61c42ddddf">PAULI_Z</a>}, 3, workspace);</div>
</div><!-- fragment --><p>will compute <img class="formulaInl" alt="$ \langle \psi | I I I I X I Z | \psi \rangle $" src="form_198.png"/> (where in this notation, the left-most operator applies to the least-significant qubit, i.e. that with index 0).</p>
<p><code>workspace</code> must be a register with the same type (state-vector vs density matrix) and dimensions (number of represented qubits) as <code>qureg</code>, and is used as working space. When this function returns, <code>qureg</code> will be unchanged and <code>workspace</code> will be set to <img class="formulaInl" alt="$ \sigma | \psi \rangle $" src="form_199.png"/> (if <code>qureg</code> is a state-vector) or <img class="formulaInl" alt="$ \sigma \rho $" src="form_200.png"/> (if <code>qureg</code> is a density matrix). NOTE that this last quantity is NOT the result of applying the paulis as unitaries, <img class="formulaInl" alt="$ \sigma^\dagger \rho \sigma $" src="form_201.png"/>, but is instead the result of their direct multiplication with the density matrix. It is therefore itself not a valid density matrix.</p>
<p>This function works by cloning the <code>qureg</code> state into <code>workspace</code>, applying the specified Pauli operators to <code>workspace</code> then computing its inner product with <code>qureg</code> (for state-vectors) or its trace (for density matrices). It therefore should scale linearly in time with the number of specified non-identity Pauli operators, which is bounded by the number of represented qubits.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810" title="Computes the expected value of the diagonal operator op for state qureg.">calcExpecDiagonalOp()</a></li>
<li><a class="el" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41" title="Computes the expected value of a sum of products of Pauli operators.">calcExpecPauliSum()</a></li>
<li><a class="el" href="group__calc.html#ga5544d2833a69941b8820797b79daf79f" title="Computes the expected value of qureg under Hermitian operator hamil.">calcExpecPauliHamil()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>the register of which to find the expected value, which is unchanged by this function </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">targetQubits</td><td>a list of the indices of the target qubits </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">pauliCodes</td><td>a list of the Pauli codes (0=PAULI_I, 1=PAULI_X, 2=PAULI_Y, 3=PAULI_Z) to apply to the corresponding qubits in <code>targetQubits</code> </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">numTargets</td><td>number of target qubits, i.e. the length of <code>targetQubits</code> and <code>pauliCodes</code> </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">workspace</td><td>a working-space qureg with the same dimensions as <code>qureg</code>, which is modified to be the result of multiplying the state with the pauli operators </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>numTargets</code> is outside [1, <code>qureg.numQubitsRepresented</code>])</li>
<li>if any qubit in <code>targetQubits</code> is outside [0, <code>qureg.numQubitsRepresented</code>))</li>
<li>if any qubit in <code>targetQubits</code> is repeated</li>
<li>if any code in <code>pauliCodes</code> is not in {0,1,2,3}</li>
<li>if <code>workspace</code> is not of the same type and dimensions as <code>qureg</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01201">1201</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01201"></a><span class="lineno"> 1201</span>  {</div>
<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span>  <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targetQubits, numTargets, __func__);</div>
<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>  <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(pauliCodes, numTargets, __func__);</div>
<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>  <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>  <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>  </div>
<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#aef380928d1b0003411d6159ca6594cd5">statevec_calcExpecPauliProd</a>(qureg, targetQubits, pauliCodes, numTargets, workspace);</div>
<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00509">statevec_calcExpecPauliProd()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00531">validateMatchingQuregDims()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00535">validateMatchingQuregTypes()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00428">validateMultiTargets()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00599">validatePauliCodes()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00302">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga50ee589fd5ceab52fdd70d0082352b41"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga50ee589fd5ceab52fdd70d0082352b41">◆ </a></span>calcExpecPauliSum()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcExpecPauliSum </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">enum <a class="el" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a> * </td>
<td class="paramname"><em>allPauliCodes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> * </td>
<td class="paramname"><em>termCoeffs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>numSumTerms</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>workspace</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the expected value of a sum of products of Pauli operators. </p>
<p>Let <img class="formulaInl" alt="$ H = \sum_i c_i \otimes_j^{N} \hat{\sigma}_{i,j} $" src="form_202.png"/> be the operators indicated by <code>allPauliCodes</code> (where <img class="formulaInl" alt="$ c_i \in $" src="form_203.png"/> <code>termCoeffs</code> and <img class="formulaInl" alt="$ N = $" src="form_204.png"/> <code>qureg.numQubitsRepresented</code>). This function computes <img class="formulaInl" alt="$ \langle \psi | H | \psi \rangle $" src="form_205.png"/> if <code>qureg</code> = <img class="formulaInl" alt="$ \psi $" src="form_85.png"/> is a state-vector, and computes <img class="formulaInl" alt="$ \text{Trace}(H \rho) =\text{Trace}(\rho H) $" src="form_206.png"/> if <code>qureg</code> = <img class="formulaInl" alt="$ \rho $" src="form_47.png"/> is a density matrix.</p>
<p><code>allPauliCodes</code> is an array of length <code>numSumTerms*<code>qureg.numQubitsRepresented</code> which</code> specifies which Pauli operators to apply, where 0 = <code>PAULI_I</code>, 1 = <code>PAULI_X</code>, 2 = <code>PAULI_Y</code>, 3 = <code>PAULI_Z</code>. For each sum term, a Pauli operator must be specified for EVERY qubit in <code>qureg</code>; each set of <code>numSumTerms</code> operators will be grouped into a product. <code>termCoeffs</code> is an arrray of length <code>numSumTerms</code> containing the term coefficients. For example, on a 3-qubit state-vector, </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> paulis[6] = {<a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a7abac7bb5b71e17382014c443244ad5c">PAULI_X</a>, <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a">PAULI_I</a>, <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a">PAULI_I</a>, <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a7abac7bb5b71e17382014c443244ad5c">PAULI_X</a>, <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a2c64a9aaee27f6bcfef894d159e759bd">PAULI_Y</a>, <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a085c85cff6ba79c52d8b1e61c42ddddf">PAULI_Z</a>};</div>
<div class="line"><a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> coeffs[2] = {1.5, -3.6};</div>
<div class="line"><a class="code" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41">calcExpecPauliSum</a>(qureg, paulis, coeffs, 2, workspace);</div>
</div><!-- fragment --><p>will compute <img class="formulaInl" alt="$ \langle \psi | (1.5 X I I - 3.6 X Y Z) | \psi \rangle $" src="form_207.png"/> (where in this notation, the left-most operator applies to the least-significant qubit, i.e. that with index 0).</p>
<p><code>workspace</code> must be a register with the same type (state-vector vs density matrix) and dimensions (number of represented qubits) as <code>qureg</code>, and is used as working space. When this function returns, <code>qureg</code> will be unchanged and <code>workspace</code> will be set to <code>qureg</code> pre-multiplied with the final Pauli product. NOTE that if <code>qureg</code> is a density matrix, <code>workspace</code> will become <img class="formulaInl" alt="$ \hat{\sigma} \rho $" src="form_208.png"/> which is itself not a density matrix (it is distinct from <img class="formulaInl" alt="$ \hat{\sigma} \rho \hat{\sigma}^\dagger $" src="form_209.png"/>).</p>
<p>This function works by cloning the <code>qureg</code> state into <code>workspace</code>, applying each of the specified Pauli products to <code>workspace</code> (one Pauli operation at a time), then computing its inner product with <code>qureg</code> (for state-vectors) or its trace (for density matrices) multiplied with the corresponding coefficient, and summing these contributions. It therefore should scale linearly in time with the total number of non-identity specified Pauli operators.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810" title="Computes the expected value of the diagonal operator op for state qureg.">calcExpecDiagonalOp()</a></li>
<li><a class="el" href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd" title="Computes the expected value of a product of Pauli operators.">calcExpecPauliProd()</a></li>
<li><a class="el" href="group__calc.html#ga5544d2833a69941b8820797b79daf79f" title="Computes the expected value of qureg under Hermitian operator hamil.">calcExpecPauliHamil()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>the register of which to find the expected value, which is unchanged by this function </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">allPauliCodes</td><td>a list of the Pauli codes (0=PAULI_I, 1=PAULI_X, 2=PAULI_Y, 3=PAULI_Z) of all Paulis involved in the products of terms. A Pauli must be specified for each qubit in the register, in every term of the sum. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">termCoeffs</td><td>The coefficients of each term in the sum of Pauli products </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">numSumTerms</td><td>The total number of Pauli products specified </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">workspace</td><td>a working-space qureg with the same dimensions as <code>qureg</code>, which is modified to be the result of multiplying the state with the final specified Pauli product </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if any code in <code>allPauliCodes</code> is not in {0,1,2,3}</li>
<li>if <code>numSumTerms</code> <= 0,</li>
<li>if <code>workspace</code> is not of the same type and dimensions as <code>qureg</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01210">1210</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>  {</div>
<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>  <a class="code" href="QuEST__validation_8c.html#a5be128290a7bba9a7f12d32cabe2276b">validateNumPauliSumTerms</a>(numSumTerms, __func__);</div>
<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>  <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(allPauliCodes, numSumTerms*qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, __func__);</div>
<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span>  <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>  <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>  </div>
<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#ae0cfea24091c8336146aa84c2253992e">statevec_calcExpecPauliSum</a>(qureg, allPauliCodes, termCoeffs, numSumTerms, workspace);</div>
<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00327">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__common_8c_source.html#l00524">statevec_calcExpecPauliSum()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00531">validateMatchingQuregDims()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00535">validateMatchingQuregTypes()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00606">validateNumPauliSumTerms()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00599">validatePauliCodes()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00444">TEST_CASE()</a>.</p>
</div>
</div>
<a id="gaa266ed6c8ae5d0d0f49e1ac50819cffc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa266ed6c8ae5d0d0f49e1ac50819cffc">◆ </a></span>calcFidelity()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcFidelity </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>pureState</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Calculates the fidelity of <code>qureg</code> (a state-vector or density matrix) against a reference pure state (necessarily a state-vector). </p>
<p>If <code>qureg</code> is a state-vector, this function computes </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ |\langle \text{qureg} | \text{pureState} \rangle|^2 \]" src="form_174.png"/>
</p>
<p> If <code>qureg</code> is a density matrix, this function computes </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \langle \text{pureState} | \text{qureg} | \text{pureState} \rangle \]" src="form_175.png"/>
</p>
<p> In either case, the returned fidelity lies in [0, 1] (assuming both input states have valid normalisation). If any of the input <code>Quregs</code> are not normalised, this function will return the real component of the correct linear algebra calculation.</p>
<p>The number of qubits represented in <code>qureg</code> and <code>pureState</code> must match.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387" title="Computes the Hilbert Schmidt distance between two density matrices a and b, defined as the Frobenius ...">calcHilbertSchmidtDistance()</a></li>
<li><a class="el" href="group__calc.html#ga683779343fb2c6055f6b1d01079c2ede" title="Calculates the purity of a density matrix, by the trace of the density matrix squared.">calcPurity()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>a density matrix or state vector </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">pureState</td><td>a state vector </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the fidelity between the input registers </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if the second argument (<code>pureState</code>) is not a state-vector</li>
<li>if the number of qubits in <code>qureg</code> and <code>pureState</code> do not match </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01191">1191</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>  {</div>
<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>  <a class="code" href="QuEST__validation_8c.html#a7adc86571f1154558676d95daf0cbd1f">validateSecondQuregStateVec</a>(pureState, __func__);</div>
<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>  <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, pureState, __func__);</div>
<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>  </div>
<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>  <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#aa6c3f86010ad398f42b0577ea3bb5bcf">densmatr_calcFidelity</a>(qureg, pureState);</div>
<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#aeeec9fe1501e25930adf6c38763a158e">statevec_calcFidelity</a>(qureg, pureState);</div>
<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00429">densmatr_calcFidelity()</a>, <a class="el" href="QuEST_8h_source.html#l00325">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST__common_8c_source.html#l00380">statevec_calcFidelity()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00531">validateMatchingQuregDims()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00539">validateSecondQuregStateVec()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00560">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga87ddbe5c8281543541ccd99e0dafd387"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga87ddbe5c8281543541ccd99e0dafd387">◆ </a></span>calcHilbertSchmidtDistance()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcHilbertSchmidtDistance </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>b</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the Hilbert Schmidt distance between two density matrices <code>a</code> and <code>b</code>, defined as the Frobenius norm of the difference between them. </p>
<p>That is, we define the Hilbert Schmidt distance </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ D(a, b) = \| a - b \|_F = \sqrt{ \text{Tr}[ (a-b)(a-b)^\dagger ] } \]" src="form_228.png"/>
</p>
<p> This is equivalent to the square-root of the sum of the absolute value squared of the element-differences of the matrices, i.e. </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ D(a, b) = \sqrt{ \sum\limits_i \sum\limits_j | a_{ij} - b_{ij} |^2 } \]" src="form_229.png"/>
</p>
<p> We caution this may differ by some definitions of the Hilbert Schmidt distance by a square-root.</p>
<p>This function correctly returns the result of the above formulations even when <code>a</code> and <code>b</code> are incorrectly normalised (i.e. are general matrices).</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga658b3a5cab5e73a17a7fd76a83583a22" title="Computes the Hilbert-Schmidt scalar product (which is equivalent to the Frobenius inner product of ma...">calcDensityInnerProduct()</a></li>
<li><a class="el" href="group__calc.html#gaa266ed6c8ae5d0d0f49e1ac50819cffc" title="Calculates the fidelity of qureg (a state-vector or density matrix) against a reference pure state (n...">calcFidelity()</a></li>
<li><a class="el" href="group__calc.html#ga683779343fb2c6055f6b1d01079c2ede" title="Calculates the purity of a density matrix, by the trace of the density matrix squared.">calcPurity()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">a</td><td>a density matrix </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>an equally-sized density matrix </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if either <code>a</code> or <code>b</code> are not density matrices</li>
<li>if <code>a</code> and <code>have</code> mismatching dimensions </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Balint Koczor </dd>
<dd>
Tyson Jones (refactored, doc) </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01237">1237</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>  {</div>
<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>  <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(a, __func__);</div>
<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>  <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(b, __func__);</div>
<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>  <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(a, b, __func__);</div>
<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>  </div>
<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a8c9da88f734b0862f4cce7d819e6d3b5">densmatr_calcHilbertSchmidtDistance</a>(a, b);</div>
<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00444">densmatr_calcHilbertSchmidtDistance()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00519">validateDensityMatrQureg()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00531">validateMatchingQuregDims()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00712">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga374ad70804998394ae41ebfe106258a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga374ad70804998394ae41ebfe106258a6">◆ </a></span>calcInnerProduct()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structComplex.html">Complex</a> calcInnerProduct </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>bra</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>ket</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the inner product <img class="formulaInl" alt="$ \langle \text{bra} | \text{ket} \rangle $" src="form_146.png"/> of two equal-size state vectors, given by. </p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \langle \text{bra} | \text{ket} \rangle = \sum_i {\text{bra}_i}^* \; \times \; \text{ket}_i \]" src="form_147.png"/>
</p>
<p> The same <code>qureg</code> may be passed as both <code>bra</code> and <code>ket</code>, though we recommend users check state-vector normalisation with <code>calcTotalProb</code> which employs Kahan summation for greater accuracy. Neither state-vector is modified.</p>
<p>This function returns the correct inner product even if <code>bra</code> and <code>ket</code> are not correctly normalised states.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga658b3a5cab5e73a17a7fd76a83583a22" title="Computes the Hilbert-Schmidt scalar product (which is equivalent to the Frobenius inner product of ma...">calcDensityInnerProduct()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">bra</td><td>qureg to be the 'bra' (i.e. have its values conjugate transposed) in the inner product </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ket</td><td>qureg to be the 'ket' in the inner product </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the complex inner product of <code>bra</code> and <code>ket</code> </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if either <code>bra</code> and <code>ket</code> are not both state-vectors</li>
<li>if <code>bra</code> and <code>ket</code> do not have equal dimensions </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01150">1150</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>  {</div>
<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>  <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(bra, __func__);</div>
<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span>  <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(ket, __func__);</div>
<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>  <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(bra, ket, __func__);</div>
<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>  </div>
<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a7ebd3198a198f4cd20840f64fd8b84d0">statevec_calcInnerProduct</a>(bra, ket);</div>
<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00035">statevec_calcInnerProduct()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00531">validateMatchingQuregDims()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00515">validateStateVecQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00808">TEST_CASE()</a>.</p>
</div>
</div>
<a id="gad0cc08d52cad5062553d6f78126780cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad0cc08d52cad5062553d6f78126780cc">◆ </a></span>calcProbOfAllOutcomes()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void calcProbOfAllOutcomes </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> * </td>
<td class="paramname"><em>outcomeProbs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>qubits</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>numQubits</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Populates <code>outcomeProbs</code> with the probabilities of every outcome of the sub-register contained in <code>qubits</code>. </p>
<blockquote class="doxtable">
<p>This performs no actual measurement and does not modify <code>qureg</code>. </p>
</blockquote>
<ul>
<li>For <code>qubits</code> <b>= {a, b, c, ...}</b>, <code>outcomeProbs</code> is populated to <p class="formulaDsp">
<img class="formulaDsp" alt="\[ \text{outcomeProbs} = \{ \; |\alpha_0|^2, \; |\alpha_1|^2, \; |\alpha_2|^2, \; |\alpha_3|^2, \; ... \; \}, \]" src="form_137.png"/>
</p>
where <img class="formulaInl" alt="$|\alpha_j|^2$" src="form_138.png"/> are the probabilities of the respective outcome states (interpreting <code>qubits</code> as ordered least to most significant) <p class="formulaDsp">
<img class="formulaDsp" alt="\[ |\dots\textbf{c\,b\,a}\rangle_i \; \; = \;\; |000\rangle, \;\; |001\rangle \;\; |010\rangle \;\; |011\rangle, \;\; \dots \]" src="form_139.png"/>
</p>
understood in a state-vector <code>qureg</code> <img class="formulaInl" alt="$|\psi\rangle$" src="form_38.png"/> as <p class="formulaDsp">
<img class="formulaDsp" alt="\[ |\psi\rangle = \sum\limits_i^{\text{numQubits}} \alpha_i \; |\dots\textbf{c\,b\,a}\rangle_i \; \otimes \; |\phi\rangle_i, \]" src="form_140.png"/>
</p>
or in a density matrix <code>qureg</code> <img class="formulaInl" alt="$\rho$" src="form_40.png"/> as <p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{aligned} \rho &= \sum\limits_{i,j}^{\text{numQubits}} \; \beta_{ij} \; |\dots\textbf{c\,b\,a}\rangle_i\,\langle\dots\textbf{c\,b\,a}|_j \; \otimes \; \mu_{ij} \\ &= \sum\limits_i^{\text{numQubits}} \; |\alpha_i|^2 \; |\dots\textbf{c\,b\,a}\rangle\langle\dots\textbf{c\,b\,a}|_i \;\; + \, \sum\limits_{i \ne j}^{\text{numQubits}} \; \beta_{ij} \; |\dots\textbf{c\,b\,a}\rangle_i\,\langle\dots\textbf{c\,b\,a}|_j \; \otimes \; \mu_{ij}, \end{aligned} \]" src="form_141.png"/>
</p>
where <img class="formulaInl" alt="$|\phi\rangle_i$" src="form_142.png"/> and <img class="formulaInl" alt="$\mu_{ij}$" src="form_143.png"/> are understood to be the separated states of the remaining qubits.</li>
</ul>
<blockquote class="doxtable">
<p><code>outcomeProbs</code> must be a pre-allocated array of length <img class="formulaInl" alt="$2^{\text{numQubits}}$" src="form_29.png"/>, which is equivalent to <b>1<<</b><code>numQubits</code>. In distributed mode, every node receives the full list of outcome probabilities. </p>
</blockquote>
<ul>
<li>Note that the indices in <code>qubits</code> need not be adjacent nor ordered. The order of <code>qubits</code> determines the order of <code>outcomeProbs</code>, whereby <code>qubits</code> are treated as <em>increasing</em> significance. <br />
<br />
</li>
<li><p class="startli">For example, given a <code>qureg</code> initialised into state-vector </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ |\psi\rangle = \alpha_0 |000\rangle \;+\; \alpha_1 |001\rangle \;+\; \alpha_2 |010\rangle \;+\; \alpha_3 |011\rangle \;+\; \alpha_4 |100\rangle \;+\; \alpha_5 |101\rangle \;+\; \alpha_6 |110\rangle \;+\; \alpha_7 |111\rangle, \]" src="form_144.png"/>
</p>
<p> then executing </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> qubits[] = {2, 0};</div>
<div class="line"><span class="keywordtype">int</span> numQubits = 2;</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> outcomeProbs[1<<numQubits];</div>
<div class="line"><a class="code" href="group__calc.html#gad0cc08d52cad5062553d6f78126780cc">calcProbOfAllOutcomes</a>(outcomeProbs, qureg, qubits, numQubits);</div>
</div><!-- fragment --><p class="startli">would populate <code>outcomeProbs</code> with </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \text{outcomeProbs} = \{ \;\; |\alpha_0|^2+|\alpha_2|^2, \;\; |\alpha_4|^2+|\alpha_6|^2, \;\; |\alpha_1|^2+|\alpha_3|^2, \;\; |\alpha_5|^2+|\alpha_7|^2 \;\; \}. \]" src="form_145.png"/>
</p>
</li>
</ul>
<blockquote class="doxtable">
<p>Since all probability amplitudes of a state-vector are ultimately involved in the output probabilities, <a class="el" href="group__calc.html#gad0cc08d52cad5062553d6f78126780cc" title="Populates outcomeProbs with the probabilities of every outcome of the sub-register contained in qubit...">calcProbOfAllOutcomes()</a> works as expected for un-normalised states. This is similarly true for density matrices, where all diagonal elements are involved, although only the real values of the diagonal elements will be consulted. </p>
</blockquote>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga2a7946e6fa4f44c9ae0c6c9f683229ad" title="Gives the probability of a specified qubit being measured in the given outcome (0 or 1).">calcProbOfOutcome()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">outcomeProbs</td><td>a pre-allocated array of length <b>1<<</b><code>numQubits</code>, which will be modified to contain all outcome probabilities </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>a state-vector or density matrix to study </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">qubits</td><td>a list of qubits to study </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">numQubits</td><td>the length of list <code>qubits</code> </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>numQubits</code> <= 0</li>
<li>if any index in <code>qubits</code> is invalid, i.e. outside <b>[0,</b> <code>qureg.numQubitsRepresented</code> <b>)</b></li>
<li>if <code>qubits</code> contains any repetitions </li>
</ul>
</td></tr>
<tr><td class="paramname">segmentation-fault</td><td><ul>
<li>if <code>outcomeProbs</code> is not pre-allocated</li>
<li>if <code>outcomeProbs</code> contains space for fewer than <b>1<<</b><code>numQubits</code> elements </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01176">1176</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>  {</div>
<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>  <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, qubits, numQubits, __func__);</div>
<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>  </div>
<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>  <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>  <a class="code" href="QuEST__internal_8h.html#a2c664d8abca0a6f87c2bf4fe75fbff90">densmatr_calcProbOfAllOutcomes</a>(retProbs, qureg, qubits, numQubits);</div>
<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>  <a class="code" href="QuEST__internal_8h.html#a78cf98ea535790bc46069b60bae342c7">statevec_calcProbOfAllOutcomes</a>(retProbs, qureg, qubits, numQubits);</div>
<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01349">densmatr_calcProbOfAllOutcomes()</a>, <a class="el" href="QuEST_8h_source.html#l00325">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01340">statevec_calcProbOfAllOutcomes()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00428">validateMultiTargets()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l00883">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga2a7946e6fa4f44c9ae0c6c9f683229ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2a7946e6fa4f44c9ae0c6c9f683229ad">◆ </a></span>calcProbOfOutcome()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcProbOfOutcome </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>measureQubit</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>outcome</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gives the probability of a specified qubit being measured in the given outcome (0 or 1). </p>
<p>This performs no actual measurement and does not change the state of the qubits.</p>
<p>For state-vectors, this function works by summing the absolute-value-squared of every amplitude in the state-vector for which <code>measureQubit</code> <code>=</code> <code>0</code>. If <code>outcome</code> <code>=</code> <code>1</code>, it returns <code>1</code> minus this value. Hence for unnormalised state-vectors, this result will differ from the absolute-value-squared of every amplitude where <code>measureQubit</code> <code>=</code> <code>outcome</code>.</p>
<p>For density matrices, this function sums the diagonal values (should be real) corresponding to <code>measureQubit</code> <code>=</code> <code>0</code> (returning 1 minus this if <code>outcome</code> <code>=</code> <code>1</code>).</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#gad0cc08d52cad5062553d6f78126780cc" title="Populates outcomeProbs with the probabilities of every outcome of the sub-register contained in qubit...">calcProbOfAllOutcomes()</a></li>
</ul>
</dd>
<dd>
<ul>
<li><a class="el" href="group__normgate.html#ga2a3794103125f1e3cfa103f8b1963656" title="Measures a single qubit, collapsing it randomly to 0 or 1.">measure()</a></li>
<li><a class="el" href="group__normgate.html#gae192ac0759e46c7b20a7182020155240" title="Measures a single qubit, collapsing it randomly to 0 or 1, and additionally gives the probability of ...">measureWithStats()</a></li>
<li><a class="el" href="group__normgate.html#ga34457f7f62ccd75fb7d3fe67cd2f815a" title="Updates qureg to be consistent with measuring measureQubit in the given outcome (0 or 1),...">collapseToOutcome()</a></li>
<li><a class="el" href="group__calc.html#gab082910d33473ec29e1d5852943de468" title="A debugging function which calculates the probability of the qubits in qureg being in any state,...">calcTotalProb()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">measureQubit</td><td>qubit to study </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">outcome</td><td>for which to find the probability of the qubit being measured in </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>probability of qubit measureQubit being measured in the given outcome </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>measureQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>)</li>
<li>if <code>outcome</code> is not in {0, 1} </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix) </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01166">1166</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>  {</div>
<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>  <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, measureQubit, __func__);</div>
<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>  <a class="code" href="QuEST__validation_8c.html#ad613c75ff252a88e54f911053bd2032c">validateOutcome</a>(outcome, __func__);</div>
<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>  </div>
<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>  <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a>(qureg, measureQubit, outcome);</div>
<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a>(qureg, measureQubit, outcome);</div>
<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01328">densmatr_calcProbOfOutcome()</a>, <a class="el" href="QuEST_8h_source.html#l00325">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01312">statevec_calcProbOfOutcome()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00523">validateOutcome()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00400">validateTarget()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01010">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga683779343fb2c6055f6b1d01079c2ede"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga683779343fb2c6055f6b1d01079c2ede">◆ </a></span>calcPurity()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcPurity </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Calculates the purity of a density matrix, by the trace of the density matrix squared. </p>
<p>Returns <img class="formulaInl" alt="$\text{Tr}(\rho^2)$" src="form_172.png"/>. For a pure state, this =1. For a mixed state, the purity is less than 1 and is lower bounded by 1/2^n, where n is the number of qubits. The minimum purity is achieved for the maximally mixed state identity/2^n.</p>
<p>This function does not accept state-vectors, which clearly have purity 1.</p>
<p>Note this function will give incorrect results for non-Hermitian Quregs (i.e. invalid density matrices), which will disagree with <img class="formulaInl" alt="$\text{Tr}(\rho^2)$" src="form_172.png"/>. Instead, this function returns <img class="formulaInl" alt="$\sum_{ij} |\rho_{ij}|^2 $" src="form_173.png"/>.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#gaa266ed6c8ae5d0d0f49e1ac50819cffc" title="Calculates the fidelity of qureg (a state-vector or density matrix) against a reference pure state (n...">calcFidelity()</a></li>
<li><a class="el" href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387" title="Computes the Hilbert Schmidt distance between two density matrices a and b, defined as the Frobenius ...">calcHilbertSchmidtDistance()</a></li>
<li><a class="el" href="group__calc.html#gab082910d33473ec29e1d5852943de468" title="A debugging function which calculates the probability of the qubits in qureg being in any state,...">calcTotalProb()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>a density matrix of which to measure the purity </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the purity </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if either <code>combineQureg</code> or <code>otherQureg</code> are not density matrices</li>
<li>if the dimensions of <code>combineQureg</code> and <code>otherQureg</code> do not match</li>
<li>if <code>prob</code> is not in [0, 1] </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01185">1185</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>  {</div>
<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>  <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>  </div>
<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#ae45eefa65f4ecd37bab84fade7cf7f1f">densmatr_calcPurity</a>(qureg);</div>
<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01358">densmatr_calcPurity()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00519">validateDensityMatrQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01133">TEST_CASE()</a>.</p>
</div>
</div>
<a id="gab082910d33473ec29e1d5852943de468"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab082910d33473ec29e1d5852943de468">◆ </a></span>calcTotalProb()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> calcTotalProb </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>A debugging function which calculates the probability of the qubits in <code>qureg</code> being in any state, which should always be 1 for correctly normalised states (hence returning a real number). </p>
<p>For state-vectors <img class="formulaInl" alt="$ \psi $" src="form_85.png"/>, this is the norm of the entire state-vector (the sum of the absolute-value-squared of every amplitude): </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \sum\limits_i |\psi_i|^2 \]" src="form_86.png"/>
</p>
<p> and for density matrices <img class="formulaInl" alt="$ \rho $" src="form_47.png"/>, it is the trace: </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \text{Trace}(\rho) = \sum\limits_i \rho_{i,i} \; \]" src="form_87.png"/>
</p>
<p>For un-normalised density matrices (those directly modified or initialised by the user), this function returns the real component of the trace.</p>
<p>Note this calculation utilises Kahan summation for greater accuracy, and hence is not parallelised and so will be slower than other functions.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>object representing a set of qubits </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the total probability of the qubits in <code>qureg</code> being in any state </dd></dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l01143">1143</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>  {</div>
<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>  <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) </div>
<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a6153547f245c05874161a105e9a2f02c">densmatr_calcTotalProb</a>(qureg);</div>
<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">statevec_calcTotalProb</a>(qureg);</div>
<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00053">densmatr_calcTotalProb()</a>, <a class="el" href="QuEST_8h_source.html#l00325">Qureg::isDensityMatrix</a>, and <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00088">statevec_calcTotalProb()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01205">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga30d6f8b7c766c9c9914b2c61a2fc0def"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga30d6f8b7c766c9c9914b2c61a2fc0def">◆ </a></span>getAmp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structComplex.html">Complex</a> getAmp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>index</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the complex amplitude at a given index in the state vector. </p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68" title="Get an amplitude from a density matrix at a given row and column.">getDensityAmp()</a></li>
<li><a class="el" href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05" title="Get the real component of the complex probability amplitude at an index in the state vector.">getRealAmp()</a></li>
<li><a class="el" href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a" title="Get the imaginary component of the complex probability amplitude at an index in the state vector.">getImagAmp()</a></li>
<li><a class="el" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b" title="Get the probability of a state-vector at an index in the full state vector.">getProbAmp()</a></li>
<li><a class="el" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df" title="Returns the number of complex amplitudes in a state-vector qureg.">getNumAmps()</a></li>
<li><a class="el" href="group__calc.html#ga73036c778d800703585ab3d8796a915f" title="Returns the number of qubits represented by qureg.">getNumQubits()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>object representing a set of qubits </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>index in state vector of probability amplitudes </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>amplitude at index, returned as a <a class="el" href="structComplex.html" title="Represents one complex number.">Complex</a> struct (with .real and .imag attributes) </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>qureg</code> is a density matrix</li>
<li>if <code>index</code> is outside [0, <img class="formulaInl" alt="$2^{N}$" src="form_83.png"/>) where <img class="formulaInl" alt="$N = $" src="form_84.png"/> <code>qureg.numQubitsRepresented</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00939">939</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00939"></a><span class="lineno"> 939</span>  {</div>
<div class="line"><a name="l00940"></a><span class="lineno"> 940</span>  <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00941"></a><span class="lineno"> 941</span>  <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00942"></a><span class="lineno"> 942</span>  </div>
<div class="line"><a name="l00943"></a><span class="lineno"> 943</span>  <a class="code" href="structComplex.html">Complex</a> amp;</div>
<div class="line"><a name="l00944"></a><span class="lineno"> 944</span>  amp.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a> = <a class="code" href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a>(qureg, index);</div>
<div class="line"><a name="l00945"></a><span class="lineno"> 945</span>  amp.<a class="code" href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">imag</a> = <a class="code" href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a>(qureg, index);</div>
<div class="line"><a name="l00946"></a><span class="lineno"> 946</span>  <span class="keywordflow">return</span> amp;</div>
<div class="line"><a name="l00947"></a><span class="lineno"> 947</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00106">Complex::imag</a>, <a class="el" href="QuEST_8h_source.html#l00105">Complex::real</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00222">statevec_getImagAmp()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00212">statevec_getRealAmp()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00382">validateAmpIndex()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00515">validateStateVecQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01272">TEST_CASE()</a>.</p>
</div>
</div>
<a id="gadca286c4ad5cde6124d4e80a7ab95a68"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadca286c4ad5cde6124d4e80a7ab95a68">◆ </a></span>getDensityAmp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structComplex.html">Complex</a> getDensityAmp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>row</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>col</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get an amplitude from a density matrix at a given row and column. </p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def" title="Get the complex amplitude at a given index in the state vector.">getAmp()</a></li>
<li><a class="el" href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05" title="Get the real component of the complex probability amplitude at an index in the state vector.">getRealAmp()</a></li>
<li><a class="el" href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a" title="Get the imaginary component of the complex probability amplitude at an index in the state vector.">getImagAmp()</a></li>
<li><a class="el" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b" title="Get the probability of a state-vector at an index in the full state vector.">getProbAmp()</a></li>
<li><a class="el" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df" title="Returns the number of complex amplitudes in a state-vector qureg.">getNumAmps()</a></li>
<li><a class="el" href="group__calc.html#ga73036c778d800703585ab3d8796a915f" title="Returns the number of qubits represented by qureg.">getNumQubits()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>object representing a density matrix </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">row</td><td>row of the desired amplitude in the density matrix </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">col</td><td>column of the desired amplitude in the density matrix </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="el" href="structComplex.html" title="Represents one complex number.">Complex</a> scalar representing the desired amplitude </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>qureg</code> is a state-vector,</li>
<li>if <code>row</code> or <code>col</code> are outside [0, <img class="formulaInl" alt="$2^{N}$" src="form_83.png"/>) where <img class="formulaInl" alt="$N = $" src="form_84.png"/> <code>qureg.numQubitsRepresented</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00949">949</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00949"></a><span class="lineno"> 949</span>  {</div>
<div class="line"><a name="l00950"></a><span class="lineno"> 950</span>  <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00951"></a><span class="lineno"> 951</span>  <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, row, __func__);</div>
<div class="line"><a name="l00952"></a><span class="lineno"> 952</span>  <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, col, __func__);</div>
<div class="line"><a name="l00953"></a><span class="lineno"> 953</span>  </div>
<div class="line"><a name="l00954"></a><span class="lineno"> 954</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> ind = row + col*(1LL << qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00955"></a><span class="lineno"> 955</span>  <a class="code" href="structComplex.html">Complex</a> amp;</div>
<div class="line"><a name="l00956"></a><span class="lineno"> 956</span>  amp.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a> = <a class="code" href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a>(qureg, ind);</div>
<div class="line"><a name="l00957"></a><span class="lineno"> 957</span>  amp.imag = <a class="code" href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a>(qureg, ind);</div>
<div class="line"><a name="l00958"></a><span class="lineno"> 958</span>  <span class="keywordflow">return</span> amp;</div>
<div class="line"><a name="l00959"></a><span class="lineno"> 959</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00327">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST_8h_source.html#l00105">Complex::real</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00222">statevec_getImagAmp()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00212">statevec_getRealAmp()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00382">validateAmpIndex()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00519">validateDensityMatrQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01311">TEST_CASE()</a>.</p>
</div>
</div>
<a id="gad575782de461d9ab0975b38cc7850f1a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad575782de461d9ab0975b38cc7850f1a">◆ </a></span>getImagAmp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> getImagAmp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>index</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the imaginary component of the complex probability amplitude at an index in the state vector. </p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def" title="Get the complex amplitude at a given index in the state vector.">getAmp()</a></li>
<li><a class="el" href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68" title="Get an amplitude from a density matrix at a given row and column.">getDensityAmp()</a></li>
<li><a class="el" href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05" title="Get the real component of the complex probability amplitude at an index in the state vector.">getRealAmp()</a></li>
<li><a class="el" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b" title="Get the probability of a state-vector at an index in the full state vector.">getProbAmp()</a></li>
<li><a class="el" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df" title="Returns the number of complex amplitudes in a state-vector qureg.">getNumAmps()</a></li>
<li><a class="el" href="group__calc.html#ga73036c778d800703585ab3d8796a915f" title="Returns the number of qubits represented by qureg.">getNumQubits()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>object representing a set of qubits </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>index in state vector of probability amplitudes </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>imaginary component at that index </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>qureg</code> is a density matrix</li>
<li>if <code>index</code> is outside [0, <img class="formulaInl" alt="$2^{N}$" src="form_83.png"/>) where <img class="formulaInl" alt="$N = $" src="form_84.png"/> <code>qureg.numQubitsRepresented</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00925">925</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00925"></a><span class="lineno"> 925</span>  {</div>
<div class="line"><a name="l00926"></a><span class="lineno"> 926</span>  <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00927"></a><span class="lineno"> 927</span>  <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00928"></a><span class="lineno"> 928</span>  </div>
<div class="line"><a name="l00929"></a><span class="lineno"> 929</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a>(qureg, index);</div>
<div class="line"><a name="l00930"></a><span class="lineno"> 930</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00222">statevec_getImagAmp()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00382">validateAmpIndex()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00515">validateStateVecQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01354">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga8cbe422d4981bf06847d229a4c6aa3df"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8cbe422d4981bf06847d229a4c6aa3df">◆ </a></span>getNumAmps()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">long long int getNumAmps </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of complex amplitudes in a state-vector <code>qureg</code>. </p>
<p>In distributed mode, this returns the total number of amplitudes in the full representation of <code>qureg</code>, and so may be larger than the number stored on each node. For the latter, refer to <a class="el" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97" title="Number of probability amplitudes held in stateVec by this process In the non-MPI version,...">Qureg.numAmpsPerChunk</a>.</p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga73036c778d800703585ab3d8796a915f" title="Returns the number of qubits represented by qureg.">getNumQubits()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>a state-vecotor </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the total number of complex amplitudes representing <code>qureg</code>. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>qureg</code> is a density matrix </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00912">912</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00912"></a><span class="lineno"> 912</span>  {</div>
<div class="line"><a name="l00913"></a><span class="lineno"> 913</span>  <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00914"></a><span class="lineno"> 914</span>  </div>
<div class="line"><a name="l00915"></a><span class="lineno"> 915</span>  <span class="keywordflow">return</span> qureg.<a class="code" href="structQureg.html#adef4935cac95763c29164cf99b144ed4">numAmpsTotal</a>;</div>
<div class="line"><a name="l00916"></a><span class="lineno"> 916</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00334">Qureg::numAmpsTotal</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00515">validateStateVecQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01392">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga73036c778d800703585ab3d8796a915f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga73036c778d800703585ab3d8796a915f">◆ </a></span>getNumQubits()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int getNumQubits </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of qubits represented by <code>qureg</code>. </p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df" title="Returns the number of complex amplitudes in a state-vector qureg.">getNumAmps()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>a state-vecor or density matrix </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>qureg.numQubitsRepresented</code> </dd></dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00908">908</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00908"></a><span class="lineno"> 908</span>  {</div>
<div class="line"><a name="l00909"></a><span class="lineno"> 909</span>  <span class="keywordflow">return</span> qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00910"></a><span class="lineno"> 910</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00327">Qureg::numQubitsRepresented</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01422">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga4a14d22379d399760b0cfc5c8053589b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4a14d22379d399760b0cfc5c8053589b">◆ </a></span>getProbAmp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> getProbAmp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>index</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the probability of a state-vector at an index in the full state vector. </p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def" title="Get the complex amplitude at a given index in the state vector.">getAmp()</a></li>
<li><a class="el" href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68" title="Get an amplitude from a density matrix at a given row and column.">getDensityAmp()</a></li>
<li><a class="el" href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05" title="Get the real component of the complex probability amplitude at an index in the state vector.">getRealAmp()</a></li>
<li><a class="el" href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a" title="Get the imaginary component of the complex probability amplitude at an index in the state vector.">getImagAmp()</a></li>
<li><a class="el" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df" title="Returns the number of complex amplitudes in a state-vector qureg.">getNumAmps()</a></li>
<li><a class="el" href="group__calc.html#ga73036c778d800703585ab3d8796a915f" title="Returns the number of qubits represented by qureg.">getNumQubits()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>object representing a set of qubits </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>index in state vector of probability amplitudes </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>realEl*realEl + imagEl*imagEl </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>qureg</code> is a density matrix</li>
<li>if <code>index</code> is outside [0, <img class="formulaInl" alt="$2^{N}$" src="form_83.png"/>) where <img class="formulaInl" alt="$N = $" src="form_84.png"/> <code>qureg.numQubitsRepresented</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00932">932</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00932"></a><span class="lineno"> 932</span>  {</div>
<div class="line"><a name="l00933"></a><span class="lineno"> 933</span>  <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00934"></a><span class="lineno"> 934</span>  <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00935"></a><span class="lineno"> 935</span>  </div>
<div class="line"><a name="l00936"></a><span class="lineno"> 936</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#a3afe58e49dce5536bc4c1b7caddf44a6">statevec_getProbAmp</a>(qureg, index);</div>
<div class="line"><a name="l00937"></a><span class="lineno"> 937</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00248">statevec_getProbAmp()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00382">validateAmpIndex()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00515">validateStateVecQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01455">TEST_CASE()</a>.</p>
</div>
</div>
<a id="ga1416145280c62c5dd5ec9bed89b4cd05"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1416145280c62c5dd5ec9bed89b4cd05">◆ </a></span>getRealAmp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> getRealAmp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>index</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the real component of the complex probability amplitude at an index in the state vector. </p>
<dl class="section see"><dt>See also</dt><dd><ul>
<li><a class="el" href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def" title="Get the complex amplitude at a given index in the state vector.">getAmp()</a></li>
<li><a class="el" href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68" title="Get an amplitude from a density matrix at a given row and column.">getDensityAmp()</a></li>
<li><a class="el" href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a" title="Get the imaginary component of the complex probability amplitude at an index in the state vector.">getImagAmp()</a></li>
<li><a class="el" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b" title="Get the probability of a state-vector at an index in the full state vector.">getProbAmp()</a></li>
<li><a class="el" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df" title="Returns the number of complex amplitudes in a state-vector qureg.">getNumAmps()</a></li>
<li><a class="el" href="group__calc.html#ga73036c778d800703585ab3d8796a915f" title="Returns the number of qubits represented by qureg.">getNumQubits()</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">qureg</td><td>object representing a set of qubits </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>index in state vector of probability amplitudes </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>real component at that index </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname"><a class="el" href="group__debug.html#ga51a64b05d31ef9bcf6a63ce26c0092db" title="An internal function called when invalid arguments are passed to a QuEST API call,...">invalidQuESTInputError()</a></td><td><ul>
<li>if <code>qureg</code> is a density matrix</li>
<li>if <code>index</code> is outside [0, <img class="formulaInl" alt="$2^{N}$" src="form_83.png"/>) where <img class="formulaInl" alt="$N = $" src="form_84.png"/> <code>qureg.numQubitsRepresented</code> </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00918">918</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00918"></a><span class="lineno"> 918</span>  {</div>
<div class="line"><a name="l00919"></a><span class="lineno"> 919</span>  <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00920"></a><span class="lineno"> 920</span>  <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00921"></a><span class="lineno"> 921</span>  </div>
<div class="line"><a name="l00922"></a><span class="lineno"> 922</span>  <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a>(qureg, index);</div>
<div class="line"><a name="l00923"></a><span class="lineno"> 923</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00212">statevec_getRealAmp()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00382">validateAmpIndex()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00515">validateStateVecQureg()</a>.</p>
<p class="reference">Referenced by <a class="el" href="test__calculations_8cpp_source.html#l01494">TEST_CASE()</a>.</p>
</div>
</div>
</div><!-- contents -->
<div class="ttc" id="aQuEST__validation_8c_html_af22919f5190ca1b3b6b52b8f2fb8213b"><div class="ttname"><a href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a></div><div class="ttdeci">void validateDensityMatrQureg(Qureg qureg, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00519">QuEST_validation.c:519</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ac31c45c5a31c523be0eb26abba6cf598"><div class="ttname"><a href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a></div><div class="ttdeci">void validateTarget(Qureg qureg, int targetQubit, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00400">QuEST_validation.c:400</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ad613c75ff252a88e54f911053bd2032c"><div class="ttname"><a href="QuEST__validation_8c.html#ad613c75ff252a88e54f911053bd2032c">validateOutcome</a></div><div class="ttdeci">void validateOutcome(int outcome, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00523">QuEST_validation.c:523</a></div></div>
<div class="ttc" id="agroup__type_html_gga1c703cf89629e4e9c7023cd402d67028a085c85cff6ba79c52d8b1e61c42ddddf"><div class="ttname"><a href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a085c85cff6ba79c52d8b1e61c42ddddf">PAULI_Z</a></div><div class="ttdeci">@ PAULI_Z</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00096">QuEST.h:96</a></div></div>
<div class="ttc" id="agroup__calc_html_gad0cc08d52cad5062553d6f78126780cc"><div class="ttname"><a href="group__calc.html#gad0cc08d52cad5062553d6f78126780cc">calcProbOfAllOutcomes</a></div><div class="ttdeci">void calcProbOfAllOutcomes(qreal *retProbs, Qureg qureg, int *qubits, int numQubits)</div><div class="ttdoc">Populates outcomeProbs with the probabilities of every outcome of the sub-register contained in qubit...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01176">QuEST.c:1176</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a6ff3dc624b5fafe8edae4fe327c255a0"><div class="ttname"><a href="QuEST__internal_8h.html#a6ff3dc624b5fafe8edae4fe327c255a0">densmatr_calcInnerProduct</a></div><div class="ttdeci">qreal densmatr_calcInnerProduct(Qureg a, Qureg b)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00455">QuEST_cpu_distributed.c:455</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_aef380928d1b0003411d6159ca6594cd5"><div class="ttname"><a href="QuEST__common_8c.html#aef380928d1b0003411d6159ca6594cd5">statevec_calcExpecPauliProd</a></div><div class="ttdeci">qreal statevec_calcExpecPauliProd(Qureg qureg, int *targetQubits, enum pauliOpType *pauliCodes, int numTargets, Qureg workspace)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00509">QuEST_common.c:509</a></div></div>
<div class="ttc" id="agroup__type_html_gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a"><div class="ttname"><a href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a">PAULI_I</a></div><div class="ttdeci">@ PAULI_I</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00096">QuEST.h:96</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a72feec2aaa05f98aed7f3c3fee141251"><div class="ttname"><a href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a></div><div class="ttdeci">void validateStateVecQureg(Qureg qureg, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00515">QuEST_validation.c:515</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ae0cfea24091c8336146aa84c2253992e"><div class="ttname"><a href="QuEST__common_8c.html#ae0cfea24091c8336146aa84c2253992e">statevec_calcExpecPauliSum</a></div><div class="ttdeci">qreal statevec_calcExpecPauliSum(Qureg qureg, enum pauliOpType *allCodes, qreal *termCoeffs, int numSumTerms, Qureg workspace)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00524">QuEST_common.c:524</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ae45eefa65f4ecd37bab84fade7cf7f1f"><div class="ttname"><a href="QuEST__internal_8h.html#ae45eefa65f4ecd37bab84fade7cf7f1f">densmatr_calcPurity</a></div><div class="ttdeci">qreal densmatr_calcPurity(Qureg qureg)</div><div class="ttdoc">Computes the trace of the density matrix squared.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01358">QuEST_cpu_distributed.c:1358</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a63cb88a5f4eb12fef087435b8db3f8eb"><div class="ttname"><a href="QuEST__internal_8h.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a></div><div class="ttdeci">qreal statevec_calcProbOfOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01312">QuEST_cpu_distributed.c:1312</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5be128290a7bba9a7f12d32cabe2276b"><div class="ttname"><a href="QuEST__validation_8c.html#a5be128290a7bba9a7f12d32cabe2276b">validateNumPauliSumTerms</a></div><div class="ttdeci">void validateNumPauliSumTerms(int numTerms, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00606">QuEST_validation.c:606</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_aeeec9fe1501e25930adf6c38763a158e"><div class="ttname"><a href="QuEST__common_8c.html#aeeec9fe1501e25930adf6c38763a158e">statevec_calcFidelity</a></div><div class="ttdeci">qreal statevec_calcFidelity(Qureg qureg, Qureg pureState)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00380">QuEST_common.c:380</a></div></div>
<div class="ttc" id="agroup__type_html_ga7740e349b4f8bae6451547680f0ce2d6"><div class="ttname"><a href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a></div><div class="ttdeci">#define qreal</div></div>
<div class="ttc" id="agroup__type_html_gga1c703cf89629e4e9c7023cd402d67028a7abac7bb5b71e17382014c443244ad5c"><div class="ttname"><a href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a7abac7bb5b71e17382014c443244ad5c">PAULI_X</a></div><div class="ttdeci">@ PAULI_X</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00096">QuEST.h:96</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a3afe58e49dce5536bc4c1b7caddf44a6"><div class="ttname"><a href="QuEST__common_8c.html#a3afe58e49dce5536bc4c1b7caddf44a6">statevec_getProbAmp</a></div><div class="ttdeci">qreal statevec_getProbAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00248">QuEST_common.c:248</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a6153547f245c05874161a105e9a2f02c"><div class="ttname"><a href="QuEST__internal_8h.html#a6153547f245c05874161a105e9a2f02c">densmatr_calcTotalProb</a></div><div class="ttdeci">qreal densmatr_calcTotalProb(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00053">QuEST_cpu_distributed.c:53</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a0fb948ddab4ca210e523aa3c52639df4"><div class="ttname"><a href="QuEST__internal_8h.html#a0fb948ddab4ca210e523aa3c52639df4">statevec_calcExpecDiagonalOp</a></div><div class="ttdeci">Complex statevec_calcExpecDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01600">QuEST_cpu_distributed.c:1600</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a8a656a83bf0b44447188d06c2f8114cb"><div class="ttname"><a href="QuEST__validation_8c.html#a8a656a83bf0b44447188d06c2f8114cb">validateDiagonalOp</a></div><div class="ttdeci">void validateDiagonalOp(Qureg qureg, DiagonalOp op, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00713">QuEST_validation.c:713</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a78cf98ea535790bc46069b60bae342c7"><div class="ttname"><a href="QuEST__internal_8h.html#a78cf98ea535790bc46069b60bae342c7">statevec_calcProbOfAllOutcomes</a></div><div class="ttdeci">void statevec_calcProbOfAllOutcomes(qreal *retProbs, Qureg qureg, int *qubits, int numQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01340">QuEST_cpu_distributed.c:1340</a></div></div>
<div class="ttc" id="astructPauliHamil_html_ac1c6c9f6299cf83bbba88123216c3cac"><div class="ttname"><a href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">PauliHamil::termCoeffs</a></div><div class="ttdeci">qreal * termCoeffs</div><div class="ttdoc">The real coefficient of each Pauli product. This is an array of length PauliHamil....</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00283">QuEST.h:283</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a2c664d8abca0a6f87c2bf4fe75fbff90"><div class="ttname"><a href="QuEST__internal_8h.html#a2c664d8abca0a6f87c2bf4fe75fbff90">densmatr_calcProbOfAllOutcomes</a></div><div class="ttdeci">void densmatr_calcProbOfAllOutcomes(qreal *retProbs, Qureg qureg, int *qubits, int numQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01349">QuEST_cpu_distributed.c:1349</a></div></div>
<div class="ttc" id="astructPauliHamil_html_a4b8d38c403553c07ceddcd40c46ce6c8"><div class="ttname"><a href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">PauliHamil::pauliCodes</a></div><div class="ttdeci">enum pauliOpType * pauliCodes</div><div class="ttdoc">The Pauli operators acting on each qubit, flattened over every operator.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00281">QuEST.h:281</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a6776217a5f7ba38b56175cf6db0f96e0"><div class="ttname"><a href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a></div><div class="ttdeci">void validateMultiTargets(Qureg qureg, int *targetQubits, int numTargetQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00428">QuEST_validation.c:428</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a87d22240ccfd81827a2a34b8d569d347"><div class="ttname"><a href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a></div><div class="ttdeci">void validateMatchingQuregDims(Qureg qureg1, Qureg qureg2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00531">QuEST_validation.c:531</a></div></div>
<div class="ttc" id="astructPauliHamil_html_a737e46b40ef8990cf004d22eb9dbe2e4"><div class="ttname"><a href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">PauliHamil::numSumTerms</a></div><div class="ttdeci">int numSumTerms</div><div class="ttdoc">The number of terms in the weighted sum, or the number of Pauli products.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00285">QuEST.h:285</a></div></div>
<div class="ttc" id="agroup__type_html_gga1c703cf89629e4e9c7023cd402d67028a2c64a9aaee27f6bcfef894d159e759bd"><div class="ttname"><a href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a2c64a9aaee27f6bcfef894d159e759bd">PAULI_Y</a></div><div class="ttdeci">@ PAULI_Y</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00096">QuEST.h:96</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a70e3b0a2297c186d5c779af31459b4ca"><div class="ttname"><a href="QuEST__internal_8h.html#a70e3b0a2297c186d5c779af31459b4ca">densmatr_calcExpecDiagonalOp</a></div><div class="ttdeci">Complex densmatr_calcExpecDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01618">QuEST_cpu_distributed.c:1618</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a7ebd3198a198f4cd20840f64fd8b84d0"><div class="ttname"><a href="QuEST__internal_8h.html#a7ebd3198a198f4cd20840f64fd8b84d0">statevec_calcInnerProduct</a></div><div class="ttdeci">Complex statevec_calcInnerProduct(Qureg bra, Qureg ket)</div><div class="ttdoc">Terrible code which unnecessarily individually computes and sums the real and imaginary components of...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00035">QuEST_cpu_distributed.c:35</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_abd509244d57657e148e4084c5ab5d28f"><div class="ttname"><a href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a></div><div class="ttdeci">qreal statevec_getImagAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00222">QuEST_cpu_distributed.c:222</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a066b0c4d0b02a0f3b9be7e5c68d9de6a"><div class="ttname"><a href="QuEST__validation_8c.html#a066b0c4d0b02a0f3b9be7e5c68d9de6a">validatePauliHamil</a></div><div class="ttdeci">void validatePauliHamil(PauliHamil hamil, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00655">QuEST_validation.c:655</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aa6c3f86010ad398f42b0577ea3bb5bcf"><div class="ttname"><a href="QuEST__internal_8h.html#aa6c3f86010ad398f42b0577ea3bb5bcf">densmatr_calcFidelity</a></div><div class="ttdeci">qreal densmatr_calcFidelity(Qureg qureg, Qureg pureState)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00429">QuEST_cpu_distributed.c:429</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a2b88b068a8242ee28da42c7324cdd078"><div class="ttname"><a href="QuEST__validation_8c.html#a2b88b068a8242ee28da42c7324cdd078">validateMatchingQuregPauliHamilDims</a></div><div class="ttdeci">void validateMatchingQuregPauliHamilDims(Qureg qureg, PauliHamil hamil, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00660">QuEST_validation.c:660</a></div></div>
<div class="ttc" id="astructQureg_html_acf78445e9435d09f44f0cc832c6aee79"><div class="ttname"><a href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">Qureg::isDensityMatrix</a></div><div class="ttdeci">int isDensityMatrix</div><div class="ttdoc">Whether this instance is a density-state representation.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00325">QuEST.h:325</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a031812e1cf2c98d72d795cea7bbe73a5"><div class="ttname"><a href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a></div><div class="ttdeci">void validateMatchingQuregTypes(Qureg qureg1, Qureg qureg2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00535">QuEST_validation.c:535</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5f87419b253a97f6caadb72b507b9853"><div class="ttname"><a href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a></div><div class="ttdeci">void validateAmpIndex(Qureg qureg, long long int ampInd, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00382">QuEST_validation.c:382</a></div></div>
<div class="ttc" id="agroup__calc_html_ga50ee589fd5ceab52fdd70d0082352b41"><div class="ttname"><a href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41">calcExpecPauliSum</a></div><div class="ttdeci">qreal calcExpecPauliSum(Qureg qureg, enum pauliOpType *allPauliCodes, qreal *termCoeffs, int numSumTerms, Qureg workspace)</div><div class="ttdoc">Computes the expected value of a sum of products of Pauli operators.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01210">QuEST.c:1210</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a7adc86571f1154558676d95daf0cbd1f"><div class="ttname"><a href="QuEST__validation_8c.html#a7adc86571f1154558676d95daf0cbd1f">validateSecondQuregStateVec</a></div><div class="ttdeci">void validateSecondQuregStateVec(Qureg qureg2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00539">QuEST_validation.c:539</a></div></div>
<div class="ttc" id="astructQureg_html_ad08dff5316b8937f4b2a1417591543dc"><div class="ttname"><a href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">Qureg::numQubitsRepresented</a></div><div class="ttdeci">int numQubitsRepresented</div><div class="ttdoc">The number of qubits represented in either the state-vector or density matrix.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00327">QuEST.h:327</a></div></div>
<div class="ttc" id="astructQureg_html_adef4935cac95763c29164cf99b144ed4"><div class="ttname"><a href="structQureg.html#adef4935cac95763c29164cf99b144ed4">Qureg::numAmpsTotal</a></div><div class="ttdeci">long long int numAmpsTotal</div><div class="ttdoc">Total number of amplitudes, which are possibly distributed among machines.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00334">QuEST.h:334</a></div></div>
<div class="ttc" id="astructComplex_html_ab5b2e2eca02131fc74b289a83636cbe3"><div class="ttname"><a href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">Complex::real</a></div><div class="ttdeci">qreal real</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00105">QuEST.h:105</a></div></div>
<div class="ttc" id="astructComplex_html_a84f5439aad0ef495efdd3b4c1c02d27e"><div class="ttname"><a href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">Complex::imag</a></div><div class="ttdeci">qreal imag</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00106">QuEST.h:106</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a8c9da88f734b0862f4cce7d819e6d3b5"><div class="ttname"><a href="QuEST__internal_8h.html#a8c9da88f734b0862f4cce7d819e6d3b5">densmatr_calcHilbertSchmidtDistance</a></div><div class="ttdeci">qreal densmatr_calcHilbertSchmidtDistance(Qureg a, Qureg b)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00444">QuEST_cpu_distributed.c:444</a></div></div>
<div class="ttc" id="astructComplex_html"><div class="ttname"><a href="structComplex.html">Complex</a></div><div class="ttdoc">Represents one complex number.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00103">QuEST.h:103</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aa194ba5f5c6e19c6caa4c715b3dbefcc"><div class="ttname"><a href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a></div><div class="ttdeci">void validatePauliCodes(enum pauliOpType *pauliCodes, int numPauliCodes, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00599">QuEST_validation.c:599</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ae37b3eff5d3affbc1edfe216cabc1c53"><div class="ttname"><a href="QuEST__internal_8h.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a></div><div class="ttdeci">qreal densmatr_calcProbOfOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01328">QuEST_cpu_distributed.c:1328</a></div></div>
<div class="ttc" id="agroup__calc_html_ga15cfad3f3d26339128e3be32ae7deacd"><div class="ttname"><a href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd">calcExpecPauliProd</a></div><div class="ttdeci">qreal calcExpecPauliProd(Qureg qureg, int *targetQubits, enum pauliOpType *pauliCodes, int numTargets, Qureg workspace)</div><div class="ttdoc">Computes the expected value of a product of Pauli operators.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01201">QuEST.c:1201</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_abc9a9ef4344c7faaaf28ac25c76649b9"><div class="ttname"><a href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a></div><div class="ttdeci">qreal statevec_getRealAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00212">QuEST_cpu_distributed.c:212</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ad65ad1b5ea6f30b0c6b4ffda96e1a8e6"><div class="ttname"><a href="QuEST__internal_8h.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">statevec_calcTotalProb</a></div><div class="ttdeci">qreal statevec_calcTotalProb(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00088">QuEST_cpu_distributed.c:88</a></div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="boot.js"></script>
</html>