Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2d1a6fb
v4.1 (#622)
TysonRayJones May 28, 2025
4d44ec8
post v4.1
TysonRayJones May 28, 2025
9d7618d
v4.2 (#692)
TysonRayJones Oct 14, 2025
8519a2d
Added unit tests requested by Quantum Motion
Jan 14, 2026
9538e94
Merge remote-tracking branch 'origin/devel' into add-validation-tests
otbrown Jan 15, 2026
399370b
Merge remote-tracking branch 'origin/devel' into add-validation-tests…
otbrown Jan 15, 2026
019ab1d
tests/unit/trotterisation.cpp: updated time evo calls to new API
otbrown Jan 15, 2026
7356386
tests/unit/trotterisation.cpp: updated authorlist
otbrown Jan 15, 2026
89d4033
Merge pull request #1 from otbrown/add-validation-tests
mcjamieson Jan 16, 2026
9e65b67
Fixed valgrind errors
Jan 19, 2026
93eeb8c
tests/unit/trotterisation.cpp: tuned floating-point comparison epsilo…
otbrown Jan 19, 2026
9d661f6
added get-arbitrary-qureg test util
TysonRayJones Jan 19, 2026
461e207
removed Qureg creation in validation tests
TysonRayJones Jan 19, 2026
d024b86
restoring missing-validation comments
TysonRayJones Jan 19, 2026
27f614e
fixing test category
TysonRayJones Jan 19, 2026
6f5644f
added missing operation validation tests
TysonRayJones Jan 19, 2026
3cd1b4f
fixed indentation
TysonRayJones Jan 19, 2026
708811d
making spacing consistent
TysonRayJones Jan 20, 2026
ef8cc79
added warning about untested deployments
TysonRayJones Jan 20, 2026
abb083c
removed defunct signature
TysonRayJones Jan 20, 2026
9794191
patching C++ validation err msg
TysonRayJones Jan 20, 2026
6d39d12
added missing C++ API signatures
TysonRayJones Jan 20, 2026
a0d3061
added C++-API validation tests
TysonRayJones Jan 20, 2026
59448ba
updated doc warnings
TysonRayJones Jan 20, 2026
3967fdc
added Vasco to Trotter API authorlist
TysonRayJones Jan 20, 2026
bca9424
merged Tyson's patches
otbrown Jan 20, 2026
3841adf
Merge branch 'feature/add-validation-tests' into add-validation-tests
otbrown Jan 20, 2026
c3e5266
Merge pull request #2 from otbrown/add-validation-tests
mcjamieson Jan 21, 2026
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
22 changes: 19 additions & 3 deletions quest/include/multiplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -746,23 +746,20 @@ extern "C" {


/// @notyetdoced
/// @notyetvalidated
/// @see
/// - leftapplyCompMatr1()
/// - applyQubitProjector()
void leftapplyQubitProjector(Qureg qureg, int qubit, int outcome);


/// @notyetdoced
/// @notyetvalidated
/// @see
/// - leftapplyCompMatr1()
/// - applyMultiQubitProjector()
void leftapplyMultiQubitProjector(Qureg qureg, int* qubits, int* outcomes, int numQubits);


/// @notyetdoced
/// @notyetvalidated
/// @see
/// - rightapplyCompMatr1()
/// - applyQubitProjector()
Expand All @@ -782,6 +779,25 @@ void rightapplyMultiQubitProjector(Qureg qureg, int* qubits, int* outcomes, int
}
#endif

#ifdef __cplusplus


/// @notyetdoced
/// @cppvectoroverload
/// @see leftapplyMultiQubitProjector()
void leftapplyMultiQubitProjector(Qureg qureg, std::vector<int> qubits, std::vector<int> outcomes);


/// @notyetdoced
/// @cppvectoroverload
/// @see rightapplyMultiQubitProjector()
void rightapplyMultiQubitProjector(Qureg qureg, std::vector<int> qubits, std::vector<int> outcomes);


#endif

/** @} */



/**
Expand Down
24 changes: 6 additions & 18 deletions quest/include/operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -2291,32 +2291,26 @@ extern "C" {


/// @notyetdoced
/// @notyetvalidated
int applyQubitMeasurement(Qureg qureg, int target);


/// @notyetdoced
/// @notyetvalidated
int applyQubitMeasurementAndGetProb(Qureg qureg, int target, qreal* probability);


/// @notyetdoced
/// @notyetvalidated
qreal applyForcedQubitMeasurement(Qureg qureg, int target, int outcome);


/// @notyetdoced
/// @notyetvalidated
qindex applyMultiQubitMeasurement(Qureg qureg, int* qubits, int numQubits);


/// @notyetdoced
/// @notyetvalidated
qindex applyMultiQubitMeasurementAndGetProb(Qureg qureg, int* qubits, int numQubits, qreal* probability);


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


Expand All @@ -2328,16 +2322,18 @@ qreal applyForcedMultiQubitMeasurement(Qureg qureg, int* qubits, int* outcomes,
#ifdef __cplusplus


/// @notyettested
/// @notyetvalidated
/// @notyetdoced
/// @cppvectoroverload
/// @see applyMultiQubitMeasurement()
qindex applyMultiQubitMeasurement(Qureg qureg, std::vector<int> qubits);


/// @notyetdoced
/// @cppvectoroverload
/// @see applyMultiQubitMeasurementAndGetProb()
qindex applyMultiQubitMeasurementAndGetProb(Qureg qureg, std::vector<int> qubits, qreal* probability);


/// @notyettested
/// @notyetvalidated
/// @notyetdoced
/// @cppvectoroverload
/// @see applyForcedMultiQubitMeasurement()
Expand All @@ -2363,12 +2359,10 @@ extern "C" {


/// @notyetdoced
/// @notyetvalidated
void applyQubitProjector(Qureg qureg, int target, int outcome);


/// @notyetdoced
/// @notyetvalidated
void applyMultiQubitProjector(Qureg qureg, int* qubits, int* outcomes, int numQubits);


Expand All @@ -2380,8 +2374,6 @@ void applyMultiQubitProjector(Qureg qureg, int* qubits, int* outcomes, int numQu
#ifdef __cplusplus


/// @notyettested
/// @notyetvalidated
/// @notyetdoced
/// @cppvectoroverload
/// @see applyMultiQubitProjector()
Expand All @@ -2407,12 +2399,10 @@ extern "C" {


/// @notyetdoced
/// @notyetvalidated
void applyQuantumFourierTransform(Qureg qureg, int* targets, int numTargets);


/// @notyetdoced
/// @notyetvalidated
void applyFullQuantumFourierTransform(Qureg qureg);


Expand All @@ -2424,8 +2414,6 @@ void applyFullQuantumFourierTransform(Qureg qureg);
#ifdef __cplusplus


/// @notyettested
/// @notyetvalidated
/// @notyetdoced
/// @cppvectoroverload
/// @see applyQuantumFourierTransform()
Expand Down
33 changes: 27 additions & 6 deletions quest/include/trotterisation.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,17 @@ extern "C" {
* - applyTrotterizedUnitaryTimeEvolution()
*
* @author Tyson Jones
* @author Vasco Ferreira (randomisation)
*/
void applyTrotterizedPauliStrSumGadget(Qureg qureg, PauliStrSum sum, qreal angle, int order, int reps, bool permutePaulis);


/// @notyetdoced
/// @notyettested
///
/// @author Tyson Jones
/// @author Vasco Ferreira (randomisation)
///
/// @see
/// - applyTrotterizedPauliStrSumGadget()
/// - applyControlledCompMatr1()
Expand All @@ -186,6 +191,10 @@ void applyTrotterizedControlledPauliStrSumGadget(Qureg qureg, int control, Pauli

/// @notyetdoced
/// @notyettested
///
/// @author Tyson Jones
/// @author Vasco Ferreira (randomisation)
///
/// @see
/// - applyTrotterizedPauliStrSumGadget()
/// - applyMultiControlledCompMatr1()
Expand All @@ -194,6 +203,10 @@ void applyTrotterizedMultiControlledPauliStrSumGadget(Qureg qureg, int* controls

/// @notyetdoced
/// @notyettested
///
/// @author Tyson Jones
/// @author Vasco Ferreira (randomisation)
///
/// @see
/// - applyTrotterizedPauliStrSumGadget()
/// - applyMultiStateControlledCompMatr1()
Expand Down Expand Up @@ -248,6 +261,7 @@ void applyTrotterizedMultiStateControlledPauliStrSumGadget(Qureg qureg, int* con
* - if @p reps is not a positive integer.
*
* @author Tyson Jones
* @author Vasco Ferreira (randomisation)
*/
void applyTrotterizedNonUnitaryPauliStrSumGadget(Qureg qureg, PauliStrSum sum, qcomp angle, int order, int reps, bool permutePaulis);

Expand All @@ -264,6 +278,10 @@ void applyTrotterizedNonUnitaryPauliStrSumGadget(Qureg qureg, PauliStrSum sum, q
/// @notyetvalidated
/// @notyetdoced
/// @cppvectoroverload
///
/// @author Tyson Jones
/// @author Vasco Ferreira (randomisation)
///
/// @see applyTrotterizedMultiControlledPauliStrSumGadget()
void applyTrotterizedMultiControlledPauliStrSumGadget(Qureg qureg, std::vector<int> controls, PauliStrSum sum, qreal angle, int order, int reps, bool permutePaulis);

Expand All @@ -272,6 +290,10 @@ void applyTrotterizedMultiControlledPauliStrSumGadget(Qureg qureg, std::vector<i
/// @notyetvalidated
/// @notyetdoced
/// @cppvectoroverload
///
/// @author Tyson Jones
/// @author Vasco Ferreira (randomisation)
///
/// @see applyTrotterizedMultiStateControlledPauliStrSumGadget()
void applyTrotterizedMultiStateControlledPauliStrSumGadget(Qureg qureg, std::vector<int> controls, std::vector<int> states, PauliStrSum sum, qreal angle, int order, int reps, bool permutePaulis);

Expand All @@ -294,9 +316,7 @@ extern "C" {
#endif


/** @notyettested
*
* Unitarily time evolves @p qureg for the duration @p time under the time-independent Hamiltonian @p hamil,
/** Unitarily time evolves @p qureg for the duration @p time under the time-independent Hamiltonian @p hamil,
* as approximated by symmetrized Trotterisation of the specified @p order and number of cycles @p reps.
*
* @formulae
Expand Down Expand Up @@ -385,13 +405,12 @@ extern "C" {
* - if @p reps is not a positive integer.
*
* @author Tyson Jones
* @author Vasco Ferreira (randomisation)
*/
void applyTrotterizedUnitaryTimeEvolution(Qureg qureg, PauliStrSum hamil, qreal time, int order, int reps, bool permutePaulis);


/** @notyettested
*
* Simulates imaginary-time evolution of @p qureg for the duration @p tau under the time-independent
/** Simulates imaginary-time evolution of @p qureg for the duration @p tau under the time-independent
* Hamiltonian @p hamil, as approximated by symmetrized Trotterisation of the specified @p order and
* number of cycles @p reps.
*
Expand Down Expand Up @@ -517,6 +536,7 @@ void applyTrotterizedUnitaryTimeEvolution(Qureg qureg, PauliStrSum hamil, qreal
* - if @p reps is not a positive integer.
*
* @author Tyson Jones
* @author Vasco Ferreira (randomisation)
*/
void applyTrotterizedImaginaryTimeEvolution(Qureg qureg, PauliStrSum hamil, qreal tau, int order, int reps, bool permutePaulis);

Expand Down Expand Up @@ -665,6 +685,7 @@ void applyTrotterizedImaginaryTimeEvolution(Qureg qureg, PauliStrSum hamil, qrea
* - if @p reps is not a positive integer.
*
* @author Tyson Jones
* @author Vasco Ferreira (randomisation)
*/
void applyTrotterizedNoisyTimeEvolution(Qureg qureg, PauliStrSum hamil, qreal* damps, PauliStrSum* jumps, int numJumps, qreal time, int order, int reps, bool permutePaulis);

Expand Down
5 changes: 5 additions & 0 deletions quest/src/api/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,11 @@ qreal applyForcedMultiQubitMeasurement(Qureg qureg, int* qubits, int* outcomes,

} // end de-mangler

qindex applyMultiQubitMeasurement(Qureg qureg, vector<int> qubits) {

return applyMultiQubitMeasurement(qureg, qubits.data(), qubits.size());
}

qindex applyMultiQubitMeasurementAndGetProb(Qureg qureg, vector<int> qubits, qreal* probability) {

return applyMultiQubitMeasurementAndGetProb(qureg, qubits.data(), qubits.size(), probability);
Expand Down
2 changes: 1 addition & 1 deletion quest/src/core/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3765,7 +3765,7 @@ void validate_measurementOutcomesMatchTargets(int numQubits, int numOutcomes, co
{"${NUM_QUBITS}", numQubits},
{"${NUM_OUTCOMES}", numOutcomes}};

assertThat(numQubits == numOutcomes, report::MEASUREMENT_OUTCOMES_MISMATCH_NUM_TARGETS, caller);
assertThat(numQubits == numOutcomes, report::MEASUREMENT_OUTCOMES_MISMATCH_NUM_TARGETS, vars, caller);
}


Expand Down
7 changes: 3 additions & 4 deletions tests/unit/initialisations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ TEST_CASE( "setQuregToWeightedSum", TEST_CATEGORY ) {

SECTION( LABEL_VALIDATION ) {

// arbitrary existing qureg
Qureg qureg = getCachedStatevecs().begin()->second;
Qureg qureg = getArbitraryCachedStatevec();

SECTION( "out qureg uninitialised" ) {

Expand Down Expand Up @@ -702,7 +701,7 @@ TEST_CASE( "setQuregToMixture", TEST_CATEGORY ) {

SECTION( "out qureg is statevector" ) {

Qureg badQureg = getCachedStatevecs().begin()->second;
Qureg badQureg = getArbitraryCachedStatevec();

REQUIRE_THROWS_WITH(
setQuregToMixture(badQureg, nullptr, nullptr, 1),
Expand All @@ -717,7 +716,7 @@ TEST_CASE( "setQuregToMixture", TEST_CATEGORY ) {

// hide a statevector among them
int badInd = GENERATE_COPY( range(0,numIn) );
inQuregs[badInd] = getCachedStatevecs().begin()->second;;
inQuregs[badInd] = getArbitraryCachedStatevec();

REQUIRE_THROWS_WITH(
setQuregToMixture(qureg, nullptr, inQuregs.data(), numIn),
Expand Down
Loading