Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4a4bdac
removed references to defunct invalidQuESTInputError
TysonRayJones Apr 13, 2025
35dccbf
added essential qureg-alloc docs
TysonRayJones Apr 14, 2025
39db589
added note to setMaxNumReportedSigFigs
TysonRayJones Apr 21, 2025
070a24e
corrected function-name typo in internal error message
TysonRayJones May 3, 2025
3e96b79
renamed @equivalent to @equivalences
TysonRayJones May 3, 2025
cea792d
added doc stubs to decoherence functions
TysonRayJones May 3, 2025
80a8c9c
adjusting decoherence stub spacing
TysonRayJones May 3, 2025
d5644a2
another missed typo
TysonRayJones May 3, 2025
51c23d7
we pray to the doc gods this is the final embarrassment
TysonRayJones May 3, 2025
100c1d3
added doc links to example PR
TysonRayJones May 7, 2025
fae527d
renaming not-yet-documented command
TysonRayJones May 12, 2025
b1448b4
linked API doc to examples
TysonRayJones May 12, 2025
3d8172a
added missing doc to example links
TysonRayJones May 12, 2025
9016148
added more essential doc formulae
TysonRayJones May 18, 2025
c3f3dbb
added equivalence note about zero-parameter
TysonRayJones May 18, 2025
a3e447d
linked C++-only func doc to C func
TysonRayJones May 18, 2025
74de7ea
linked multiply* doc to multiplyCompMatr1
TysonRayJones May 18, 2025
135d4c0
linked applyMultiStateControlled* doc to (...)CompMatr1()
TysonRayJones May 18, 2025
4e273e4
divided @cpponly into @cppvectoroverload
TysonRayJones May 18, 2025
09d4ae0
temporarily hiding cppvectoroverload
TysonRayJones May 18, 2025
46cc773
fixed launch.md typo
TysonRayJones May 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
@author Tyson Jones
-->

> [!TIP]
> See [PR #615](https://github.com/QuEST-Kit/QuEST/pull/615) for an illustration of integrating
> new functions into the QuEST software architecture.

All user-visible API signatures are contained in `include/`, divided into semantic submodules (like `calculations.h` and `qureg.h`), but all exposed by `quest.h`. They are all strictly `C` _and_ `C++` compatible, hence their `.h` file extension.

The source code within `src/` is divided between five subdirectories, listed below in order of increasing control flow depth. All code is parsed strictly by `C++`, hence all files have `.cpp` and `.hpp` extensions.
Expand Down
4 changes: 4 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
<!--- @todo -->

In the meantime, feel free to open an issue, a discussion or a pull request, or reach out to `tyson.jones.input@gmail.com`.

> [!TIP]
> See [PR #615](https://github.com/QuEST-Kit/QuEST/pull/615) for an illustration of integrating
> new functions into the QuEST software architecture.
2 changes: 1 addition & 1 deletion docs/launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ For convenience however, we offer some example [SLURM](https://slurm.schedmd.com
#SBATCH --nodes=4
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=8
OMP_NUM_THREADS=8 mpirun ./myexec
OMP_NUM_THREADS=8 srun ./myexec
```

1 machine with 4 local GPUs:
Expand Down
117 changes: 62 additions & 55 deletions quest/include/calculations.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@ extern "C" {
* which case the imaginary component of the above expression is neglected.
* The full complex value can be obtained using calcExpecNonHermitianPauliStrSum().
*
* @equivalence
* @equivalences
* - When @p str is general, this function is equivalent to calling calcExpecPauliStrSum() with a
* PauliStrSum composed of only a single PauliStr term and a unity coefficient.
* - When @p str @f$ = \id^\otimes @f$, the output is equivalent to that of calcTotalProb().
*
* @myexample
* ```
Qureg qureg = createQureg(4);
PauliStr str = getPauliStr("XYZ");
Qureg qureg = createQureg(10);
initRandomPureState(qureg);

PauliStr str = getInlinePauliStr("XYZ", {0,2,3});

qreal expec = calcExpecPauliStr(qureg, str);
reportScalar("expec", expec);
Expand All @@ -89,11 +91,11 @@ extern "C" {
* @param[in] qureg the reference state.
* @param[in] str the observable operator.
* @returns The real component of the expectation value.
* @throws invalidQuESTInputError()
* @throws @validationerror
* - if @p qureg is uninitialised.
* - if @p str contains a (non-identity) Pauli upon a higher-index qubit than exists in @p qureg.
* - if the output (with unreturned imaginary component) is not approximately real.
* @notvalidated
* @notyetvalidated
* @author Tyson Jones
*/
qreal calcExpecPauliStr(Qureg qureg, PauliStr str);
Expand Down Expand Up @@ -125,7 +127,7 @@ qreal calcExpecPauliStr(Qureg qureg, PauliStr str);
* Hermiticity validation is relaxed and/or @p qureg is an unnormalised density matrix.
* The full complex value can be obtained using calcExpecNonHermitianPauliStrSum().
*
* @equivalence
* @equivalences
* - This function is mathematically equivalent to (albeit faster than) calling calcExpecPauliStr() upon
* each constituent @p PauliStr within @p sum, weighting each by its corresponding coefficient, and
* summing the outputs.
Expand All @@ -145,15 +147,16 @@ qreal calcExpecPauliStr(Qureg qureg, PauliStr str);
qreal expec = calcExpecPauliStrSum(qureg, sum);
reportScalar("expec", expec);
* ```
*
* @param[in] qureg the reference state.
* @param[in] sum the observable operator.
* @returns The real component of the expectation value.
* @throws invalidQuESTInputError()
* @throws @validationerror
* - if @p qureg or @p sum are uninitialised.
* - if any PauliStr in @p sum targets a higher-index qubit than exists in @p qureg.
* - if @p sum is not approximately Hermitian.
* - if the output (with unreturned imaginary component) is not approximately real.
* @notvalidated
* @notyetvalidated
* @see
* - calcExpecNonHermitianPauliStrSum()
* - calcExpecFullStateDiagMatr()
Expand All @@ -162,13 +165,13 @@ qreal calcExpecPauliStr(Qureg qureg, PauliStr str);
qreal calcExpecPauliStrSum(Qureg qureg, PauliStrSum sum);


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcExpecFullStateDiagMatr(Qureg qureg, FullStateDiagMatr matr);


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcExpecFullStateDiagMatrPower(Qureg qureg, FullStateDiagMatr matr, qreal exponent);


Expand All @@ -183,23 +186,23 @@ qreal calcExpecFullStateDiagMatrPower(Qureg qureg, FullStateDiagMatr matr, qreal
*/


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcProbOfBasisState(Qureg qureg, qindex index);


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcProbOfQubitOutcome(Qureg qureg, int qubit, int outcome);


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcProbOfMultiQubitOutcome(Qureg qureg, int* qubits, int* outcomes, int numQubits);


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
void calcProbsOfAllMultiQubitOutcomes(qreal* outcomeProbs, Qureg qureg, int* qubits, int numQubits);


Expand All @@ -214,13 +217,13 @@ void calcProbsOfAllMultiQubitOutcomes(qreal* outcomeProbs, Qureg qureg, int* qub
*/


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcTotalProb(Qureg qureg);


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcPurity(Qureg qureg);


Expand All @@ -235,12 +238,12 @@ qreal calcPurity(Qureg qureg);
*/


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcFidelity(Qureg qureg, Qureg other);

/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qreal calcDistance(Qureg qureg1, Qureg qureg2);


Expand All @@ -255,13 +258,13 @@ qreal calcDistance(Qureg qureg1, Qureg qureg2);
*/


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
Qureg calcPartialTrace(Qureg qureg, int* traceOutQubits, int numTraceQubits);


/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
Qureg calcReducedDensityMatrix(Qureg qureg, int* retainQubits, int numRetainQubits);


Expand Down Expand Up @@ -292,26 +295,26 @@ Qureg calcReducedDensityMatrix(Qureg qureg, int* retainQubits, int numRetainQubi


/// @ingroup calc_comparisons
/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qcomp calcInnerProduct(Qureg qureg1, Qureg qureg2);


/// @ingroup calc_expec
/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qcomp calcExpecNonHermitianPauliStrSum(Qureg qureg, PauliStrSum sum);


/// @ingroup calc_expec
/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qcomp calcExpecNonHermitianFullStateDiagMatr(Qureg qureg, FullStateDiagMatr matr);


/// @ingroup calc_expec
/// @notdoced
/// @notvalidated
/// @notyetdoced
/// @notyetvalidated
qcomp calcExpecNonHermitianFullStateDiagMatrPower(Qureg qureg, FullStateDiagMatr matrix, qcomp exponent);


Expand All @@ -330,34 +333,38 @@ qcomp calcExpecNonHermitianFullStateDiagMatrPower(Qureg qureg, FullStateDiagMatr


/// @ingroup calc_prob
/// @nottested
/// @notdoced
/// @notvalidated
/// @cpponly
/// @notyettested
/// @notyetdoced
/// @notyetvalidated
/// @cppoverload
/// @see calcProbOfMultiQubitOutcome()
qreal calcProbOfMultiQubitOutcome(Qureg qureg, std::vector<int> qubits, std::vector<int> outcomes);


/// @ingroup calc_prob
/// @nottested
/// @notdoced
/// @notvalidated
/// @notyettested
/// @notyetdoced
/// @notyetvalidated
/// @cpponly
/// @see calcProbsOfAllMultiQubitOutcomes()
std::vector<qreal> calcProbsOfAllMultiQubitOutcomes(Qureg qureg, std::vector<int> qubits);


/// @ingroup calc_partialtrace
/// @nottested
/// @notdoced
/// @notvalidated
/// @cpponly
/// @notyettested
/// @notyetdoced
/// @notyetvalidated
/// @cppoverload
/// @see calcPartialTrace()
Qureg calcPartialTrace(Qureg qureg, std::vector<int> traceOutQubits);


/// @ingroup calc_partialtrace
/// @nottested
/// @notdoced
/// @notvalidated
/// @cpponly
/// @notyettested
/// @notyetdoced
/// @notyetvalidated
/// @cppoverload
/// @see calcReducedDensityMatrix()
Qureg calcReducedDensityMatrix(Qureg qureg, std::vector<int> retainQubits);


Expand Down
Loading