From d926b5e9aa74aa590ed7efd39e9045d393775b6f Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:31:51 -0400 Subject: [PATCH 01/17] rename setSeeds and setSeedsToDefault --- docs/tutorial.md | 2 +- quest/include/debug.h | 8 ++++---- quest/include/deprecated.h | 8 ++++---- quest/src/api/debug.cpp | 8 ++++---- tests/unit/debug.cpp | 32 ++++++++++++++++---------------- tests/utils/random.cpp | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index b3e99706e..9fdced89b 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -176,7 +176,7 @@ Configuring the environment is ordinarily not necessary, but convenient in certa For example, we may wish our simulations to deterministically obtain the same measurement outcomes and random states as a previous or future run, and ergo choose to [override](https://quest-kit.github.io/QuEST/group__debug__seed.html#ga9e3a6de413901afbf50690573add1587) the default seeds. ```cpp unsigned seeds[] = {123u, 1u << 10}; -setSeeds(seeds, 2); +setQuESTSeeds(seeds, 2); ``` We may wish further to [adjust](https://quest-kit.github.io/QuEST/group__debug__reporting.html) how subsequent functions will display information to the screen diff --git a/quest/include/debug.h b/quest/include/debug.h index 48ef22527..f37d8112b 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -43,11 +43,11 @@ extern "C" { /// @notyetdoced -void setSeeds(unsigned* seeds, int numSeeds); +void setQuESTSeeds(unsigned* seeds, int numSeeds); /// @notyetdoced -void setSeedsToDefault(); +void setQuESTSeedsToDefault(); /// @notyetdoced @@ -225,8 +225,8 @@ void getEnvironmentString(char str[200]); /// @notyettested /// @notyetdoced /// @cppvectoroverload -/// @see setSeeds() -void setSeeds(std::vector seeds); +/// @see setQuESTSeeds() +void setQuESTSeeds(std::vector seeds); /// @ingroup debug_seed diff --git a/quest/include/deprecated.h b/quest/include/deprecated.h index 1a63b2044..7a348700a 100644 --- a/quest/include/deprecated.h +++ b/quest/include/deprecated.h @@ -1331,12 +1331,12 @@ static inline void _multiControlledMultiRotatePauli(Qureg qureg, int* ctrls, int #define seedQuESTDefault(...) \ - _WARN_FUNC_RENAMED("seedQuESTDefault(QuESTEnv)", "setSeedsToDefault()") \ - setSeedsToDefault() + _WARN_FUNC_RENAMED("seedQuESTDefault(QuESTEnv)", "setQuESTSeedsToDefault()") \ + setQuESTSeedsToDefault() #define seedQuEST(env, seeds, numSeeds) \ - _WARN_FUNC_RENAMED("seedQuEST(QuESTEnv, unsigned long int*, int)", "setSeeds(unsigned*, int)") \ - setSeeds(seeds, numSeeds) + _WARN_FUNC_RENAMED("seedQuEST(QuESTEnv, unsigned long int*, int)", "setQuESTSeeds(unsigned*, int)") \ + setQuESTSeeds(seeds, numSeeds) diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 82146da2a..6c5211c74 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -34,7 +34,7 @@ extern "C" { */ -void setSeeds(unsigned* seeds, int numSeeds) { +void setQuESTSeeds(unsigned* seeds, int numSeeds) { validate_envIsInit(__func__); validate_randomSeeds(seeds, numSeeds, __func__); @@ -42,7 +42,7 @@ void setSeeds(unsigned* seeds, int numSeeds) { rand_setSeeds(vector(seeds, seeds+numSeeds)); } -void setSeedsToDefault() { +void setQuESTSeedsToDefault() { validate_envIsInit(__func__); rand_setSeedsToDefault(); @@ -206,8 +206,8 @@ void clearGpuCache() { */ -void setSeeds(vector seeds) { - setSeeds(seeds.data(), seeds.size()); +void setQuESTSeeds(vector seeds) { + setQuESTSeeds(seeds.data(), seeds.size()); } vector getSeeds() { diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 07a967493..1f1f52dae 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -154,7 +154,7 @@ TEST_CASE( "setNumReportedNewlines", TEST_CATEGORY ) { } -TEST_CASE( "setSeeds", TEST_CATEGORY ) { +TEST_CASE( "setQuESTSeeds", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { @@ -173,7 +173,7 @@ TEST_CASE( "setSeeds", TEST_CATEGORY ) { const int numReps = 5; // set an arbitrary fixed seed... - setSeeds(seeds, numSeeds); + setQuESTSeeds(seeds, numSeeds); // generate and remember a random state initRandomMixedState(qureg, numMixedStates); @@ -188,7 +188,7 @@ TEST_CASE( "setSeeds", TEST_CATEGORY ) { for (int r=0; r(getRandomInt(0, 99999)); // pass seeds to QuEST - setSeeds(in.data(), numSeeds); + setQuESTSeeds(in.data(), numSeeds); // check we get them back vector out(numSeeds); @@ -339,7 +339,7 @@ TEST_CASE( "getSeeds", TEST_CATEGORY ) { } // re-randomise seeds for remaining tests - setSeedsToDefault(); + setQuESTSeedsToDefault(); } @@ -363,7 +363,7 @@ TEST_CASE( "getNumSeeds", TEST_CATEGORY ) { in[i] = static_cast(getRandomInt(0, 99999)); // pass seeds to QuEST - setSeeds(in.data(), numSeeds); + setQuESTSeeds(in.data(), numSeeds); // confirm we get out correct number REQUIRE( getNumSeeds() == numSeeds ); @@ -380,7 +380,7 @@ TEST_CASE( "getNumSeeds", TEST_CATEGORY ) { } // re-randomise seeds for remaining tests - setSeedsToDefault(); + setQuESTSeedsToDefault(); } @@ -393,7 +393,7 @@ TEST_CASE( "setValidationOn", TEST_CATEGORY ) { REQUIRE_NOTHROW( setValidationOn() ); // illegal and caught - REQUIRE_THROWS( setSeeds(nullptr, -99) ); + REQUIRE_THROWS( setQuESTSeeds(nullptr, -99) ); } SECTION( LABEL_VALIDATION ) { diff --git a/tests/utils/random.cpp b/tests/utils/random.cpp index 65d087518..e012fb541 100644 --- a/tests/utils/random.cpp +++ b/tests/utils/random.cpp @@ -44,7 +44,7 @@ void setRandomTestStateSeeds() { unsigned seed = cspnrg(); // seed QuEST, which uses only the root node's seed - setSeeds(&seed, 1); + setQuESTSeeds(&seed, 1); // broadcast root node seed to all nodes getSeeds(&seed); From 0731c1b7c2421717b340c7ff85ffc2e1a98270bc Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:34:58 -0400 Subject: [PATCH 02/17] rename getSeeds --- quest/include/debug.h | 6 +++--- quest/include/deprecated.h | 2 +- quest/src/api/debug.cpp | 6 +++--- tests/unit/debug.cpp | 6 +++--- tests/utils/random.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/quest/include/debug.h b/quest/include/debug.h index f37d8112b..ba45998c0 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -51,7 +51,7 @@ void setQuESTSeedsToDefault(); /// @notyetdoced -void getSeeds(unsigned* seeds); +void getQuESTSeeds(unsigned* seeds); /// @notyetdoced @@ -233,8 +233,8 @@ void setQuESTSeeds(std::vector seeds); /// @notyettested /// @notyetdoced /// @cpponly -/// @see getSeeds() -std::vector getSeeds(); +/// @see getQuESTSeeds() +std::vector getQuESTSeeds(); #endif // __cplusplus diff --git a/quest/include/deprecated.h b/quest/include/deprecated.h index 7a348700a..08f8c76fc 100644 --- a/quest/include/deprecated.h +++ b/quest/include/deprecated.h @@ -452,7 +452,7 @@ typedef enum pauliOpType _NoWarnPauliOpType; #define getQuESTSeeds(...) \ _ERROR_GENERAL_MSG( \ "The QuEST function 'getQuESTSeeds(QuESTEnv env, unsigned long int* out, int numOut)' has been deprecated. " \ - "Please instead use 'getSeeds(unsigned* out)' which accepts a pointer to pre-allocated memory of length " \ + "Please instead use 'getQuESTSeeds(unsigned* out)' which accepts a pointer to pre-allocated memory of length " \ "equal to that returned by 'getNumSeeds()'. We cannot automatically invoke this replacement routine." ) diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 6c5211c74..af60f3bfa 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -55,7 +55,7 @@ int getNumSeeds() { return rand_getNumSeeds(); } -void getSeeds(unsigned* seeds) { +void getQuESTSeeds(unsigned* seeds) { validate_envIsInit(__func__); auto vec = rand_getSeeds(); @@ -210,7 +210,7 @@ void setQuESTSeeds(vector seeds) { setQuESTSeeds(seeds.data(), seeds.size()); } -vector getSeeds() { +vector getQuESTSeeds() { validate_envIsInit(__func__); // allocate temp vector, and pedantically validate successful @@ -219,6 +219,6 @@ vector getSeeds() { auto callback = [&]() { validate_tempListAllocSucceeded(false, numSeeds, sizeof(unsigned), __func__); }; util_tryAllocVector(out, numSeeds, callback); - getSeeds(out.data()); + getQuESTSeeds(out.data()); return out; } diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 1f1f52dae..6871625fb 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -294,7 +294,7 @@ TEST_CASE( "setQuESTSeedsToDefault", TEST_CATEGORY ) { } -TEST_CASE( "getSeeds", TEST_CATEGORY ) { +TEST_CASE( "getQuESTSeeds", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { @@ -305,7 +305,7 @@ TEST_CASE( "getSeeds", TEST_CATEGORY ) { int numSeeds = getNumSeeds(); vector out(numSeeds); - REQUIRE_NOTHROW( getSeeds(out.data()) ); + REQUIRE_NOTHROW( getQuESTSeeds(out.data()) ); } SECTION( "correct output" ) { @@ -323,7 +323,7 @@ TEST_CASE( "getSeeds", TEST_CATEGORY ) { // check we get them back vector out(numSeeds); - getSeeds(out.data()); + getQuESTSeeds(out.data()); for (int i=0; i Date: Mon, 18 May 2026 22:37:30 -0400 Subject: [PATCH 03/17] rename getNumSeeds --- quest/include/debug.h | 2 +- quest/include/deprecated.h | 2 +- quest/src/api/debug.cpp | 4 ++-- tests/unit/debug.cpp | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/quest/include/debug.h b/quest/include/debug.h index ba45998c0..f00f14448 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -55,7 +55,7 @@ void getQuESTSeeds(unsigned* seeds); /// @notyetdoced -int getNumSeeds(); +int getQuESTNumSeeds(); /** @} */ diff --git a/quest/include/deprecated.h b/quest/include/deprecated.h index 08f8c76fc..6461946fa 100644 --- a/quest/include/deprecated.h +++ b/quest/include/deprecated.h @@ -453,7 +453,7 @@ typedef enum pauliOpType _NoWarnPauliOpType; _ERROR_GENERAL_MSG( \ "The QuEST function 'getQuESTSeeds(QuESTEnv env, unsigned long int* out, int numOut)' has been deprecated. " \ "Please instead use 'getQuESTSeeds(unsigned* out)' which accepts a pointer to pre-allocated memory of length " \ - "equal to that returned by 'getNumSeeds()'. We cannot automatically invoke this replacement routine." ) + "equal to that returned by 'getQuESTNumSeeds()'. We cannot automatically invoke this replacement routine." ) #define applyPhaseFunc(...) \ diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index af60f3bfa..c92b1c587 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -49,7 +49,7 @@ void setQuESTSeedsToDefault() { } -int getNumSeeds() { +int getQuESTNumSeeds() { validate_envIsInit(__func__); return rand_getNumSeeds(); @@ -215,7 +215,7 @@ vector getQuESTSeeds() { // allocate temp vector, and pedantically validate successful vector out; - int numSeeds = getNumSeeds(); + int numSeeds = rand_getNumSeeds(); auto callback = [&]() { validate_tempListAllocSucceeded(false, numSeeds, sizeof(unsigned), __func__); }; util_tryAllocVector(out, numSeeds, callback); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 6871625fb..c987c74c4 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -300,9 +300,9 @@ TEST_CASE( "getQuESTSeeds", TEST_CATEGORY ) { SECTION( "can be called immediately" ) { - REQUIRE_NOTHROW( getNumSeeds() ); + REQUIRE_NOTHROW( getQuESTNumSeeds() ); - int numSeeds = getNumSeeds(); + int numSeeds = getQuESTNumSeeds(); vector out(numSeeds); REQUIRE_NOTHROW( getQuESTSeeds(out.data()) ); @@ -343,13 +343,13 @@ TEST_CASE( "getQuESTSeeds", TEST_CATEGORY ) { } -TEST_CASE( "getNumSeeds", TEST_CATEGORY ) { +TEST_CASE( "getQuESTNumSeeds", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { SECTION( "can be called immediately" ) { - REQUIRE_NOTHROW( getNumSeeds() ); + REQUIRE_NOTHROW( getQuESTNumSeeds() ); } SECTION( "correct output" ) { @@ -366,7 +366,7 @@ TEST_CASE( "getNumSeeds", TEST_CATEGORY ) { setQuESTSeeds(in.data(), numSeeds); // confirm we get out correct number - REQUIRE( getNumSeeds() == numSeeds ); + REQUIRE( getQuESTNumSeeds() == numSeeds ); } } From 8f865eb5c9802c885d3b5a0035855b0ee73e9caa Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:38:22 -0400 Subject: [PATCH 04/17] rename setInputErrorHandler --- docs/tutorial.md | 4 ++-- examples/isolated/setting_errorhandler.c | 2 +- examples/isolated/setting_errorhandler.cpp | 4 ++-- quest/include/debug.h | 2 +- quest/src/api/debug.cpp | 2 +- tests/deprecated/test_main.cpp | 2 +- tests/main.cpp | 2 +- tests/unit/debug.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 9fdced89b..4eb95eb02 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -205,7 +205,7 @@ void myErrorHandler(const char *func, const char *msg) { exit(1); } -setInputErrorHandler(myErrorHandler); +setQuESTInputErrorHandler(myErrorHandler); ``` > [!TIP] @@ -218,7 +218,7 @@ setInputErrorHandler(myErrorHandler); > std::string msg(errMsg); > throw std::runtime_error(func + ": " + msg); > } -> setInputErrorHandler(myErrorHandler); +> setQuESTInputErrorHandler(myErrorHandler); > ``` diff --git a/examples/isolated/setting_errorhandler.c b/examples/isolated/setting_errorhandler.c index 9f777f122..7d980f495 100644 --- a/examples/isolated/setting_errorhandler.c +++ b/examples/isolated/setting_errorhandler.c @@ -19,7 +19,7 @@ void myErrorHandler(const char* errFunc, const char* errMsg) { int main() { initQuESTEnv(); - setInputErrorHandler(myErrorHandler); + setQuESTInputErrorHandler(myErrorHandler); Qureg qureg = createQureg(-123); diff --git a/examples/isolated/setting_errorhandler.cpp b/examples/isolated/setting_errorhandler.cpp index 4a41ef30c..79d3995dc 100644 --- a/examples/isolated/setting_errorhandler.cpp +++ b/examples/isolated/setting_errorhandler.cpp @@ -48,7 +48,7 @@ void myErrorHandlerB(const char* errFunc, const char* errMsg) { int main() { initQuESTEnv(); - setInputErrorHandler(myErrorHandlerA); + setQuESTInputErrorHandler(myErrorHandlerA); try { Qureg qureg = createQureg(-123); @@ -59,7 +59,7 @@ int main() { << std::endl; } - setInputErrorHandler(myErrorHandlerB); + setQuESTInputErrorHandler(myErrorHandlerB); initQuESTEnv(); // illegal to recall std::cout << "this will never be reached, because myErrorHandlerB exits!" << std::endl; diff --git a/quest/include/debug.h b/quest/include/debug.h index f00f14448..2f56380c0 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -79,7 +79,7 @@ int getQuESTNumSeeds(); * - [C](https://github.com/QuEST-Kit/QuEST/blob/devel/examples/isolated/setting_errorhandler.c) and * [C++](https://github.com/QuEST-Kit/QuEST/blob/devel/examples/isolated/setting_errorhandler.cpp) examples */ -void setInputErrorHandler(void (*callback)(const char* func, const char* msg)); +void setQuESTInputErrorHandler(void (*callback)(const char* func, const char* msg)); /// @notyetdoced diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index c92b1c587..a25743887 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -71,7 +71,7 @@ void getQuESTSeeds(unsigned* seeds) { * VALIDATION */ -void setInputErrorHandler(void (*callback)(const char*, const char*)) { +void setQuESTInputErrorHandler(void (*callback)(const char*, const char*)) { validate_envIsInit(__func__); validateconfig_setErrorHandler(callback); diff --git a/tests/deprecated/test_main.cpp b/tests/deprecated/test_main.cpp index 35ba37477..628a9c8d8 100644 --- a/tests/deprecated/test_main.cpp +++ b/tests/deprecated/test_main.cpp @@ -41,7 +41,7 @@ extern "C" void validationErrorHandler(const char* errFunc, const char* errMsg) int main(int argc, char* argv[]) { initQuESTEnv(); - setInputErrorHandler(validationErrorHandler); + setQuESTInputErrorHandler(validationErrorHandler); setRandomTestStateSeeds(); int result = Catch::Session().run( argc, argv ); diff --git a/tests/main.cpp b/tests/main.cpp index fca57f5ff..dc1032d92 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) { // prepare QuEST before anything else, since many // testing utility functions repurpose QuEST ones initQuESTEnv(); - setInputErrorHandler(validationErrorHandler); + setQuESTInputErrorHandler(validationErrorHandler); // ensure RNG consensus among all nodes setRandomTestStateSeeds(); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index c987c74c4..2f6221241 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -46,7 +46,7 @@ using std::vector; */ -TEST_CASE( "setInputErrorHandler", TEST_CATEGORY ) { +TEST_CASE( "setQuESTInputErrorHandler", TEST_CATEGORY ) { /// @todo /// We can test this by saving the current handler, From 83759a85c973e1a66f3b6c6bf5ab57f1d2406ada Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:40:52 -0400 Subject: [PATCH 05/17] rename setValidationOn and setValidationOff --- quest/include/calculations.h | 2 +- quest/include/debug.h | 4 ++-- quest/src/api/debug.cpp | 4 ++-- tests/deprecated/test_calculations.cpp | 4 ++-- tests/unit/debug.cpp | 12 ++++++------ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/quest/include/calculations.h b/quest/include/calculations.h index 645f54c34..8043a3910 100644 --- a/quest/include/calculations.h +++ b/quest/include/calculations.h @@ -284,7 +284,7 @@ qreal calcExpecFullStateDiagMatr(Qureg qureg, FullStateDiagMatr matr); * > consult the imaginary components of the elements of @p matrix, since a non-complex exponentiation * > function is used. That is, while validation permits the imaginary components to be small, they * > will be internally treated as precisely zero. This is true even when Hermiticity validation - * > is disabled using setValidationOff(). To consult the imaginary components of @p matrix, use + * > is disabled using setQuESTValidationOff(). To consult the imaginary components of @p matrix, use * > calcExpecNonHermitianFullStateDiagMatrPower(). * * - Hermiticity of @p matrix when raised to @p exponent further requires that, when @p exponent is diff --git a/quest/include/debug.h b/quest/include/debug.h index 2f56380c0..607d0162f 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -83,11 +83,11 @@ void setQuESTInputErrorHandler(void (*callback)(const char* func, const char* ms /// @notyetdoced -void setValidationOn(); +void setQuESTValidationOn(); /// @notyetdoced -void setValidationOff(); +void setQuESTValidationOff(); /// @notyetdoced diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index a25743887..e99fcd172 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -77,13 +77,13 @@ void setQuESTInputErrorHandler(void (*callback)(const char*, const char*)) { validateconfig_setErrorHandler(callback); } -void setValidationOn() { +void setQuESTValidationOn() { validate_envIsInit(__func__); validateconfig_enable(); } -void setValidationOff() { +void setQuESTValidationOff() { validate_envIsInit(__func__); // disables all validation and computation diff --git a/tests/deprecated/test_calculations.cpp b/tests/deprecated/test_calculations.cpp index 0f02a6dea..9ce963fb2 100644 --- a/tests/deprecated/test_calculations.cpp +++ b/tests/deprecated/test_calculations.cpp @@ -386,9 +386,9 @@ TEST_CASE( "calcExpecPauliProd", "[calculations]" ) { // (get real, since we start in a non-Hermitian state, hence diagonal isn't real) // disable validation during call, because result is non-real and will upset post-check - setValidationOff(); + setQuESTValidationOff(); qreal res = calcExpecPauliProd(mat, targs, paulis.data(), numTargs, matWork); - setValidationOn(); + setQuESTValidationOn(); REQUIRE( res == Approx(tr).margin(10*REAL_EPS) ); } diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 2f6221241..ada1df044 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -384,13 +384,13 @@ TEST_CASE( "getQuESTNumSeeds", TEST_CATEGORY ) { } -TEST_CASE( "setValidationOn", TEST_CATEGORY ) { +TEST_CASE( "setQuESTValidationOn", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { // always safe to call for (int i=0; i<3; i++) - REQUIRE_NOTHROW( setValidationOn() ); + REQUIRE_NOTHROW( setQuESTValidationOn() ); // illegal and caught REQUIRE_THROWS( setQuESTSeeds(nullptr, -99) ); @@ -404,13 +404,13 @@ TEST_CASE( "setValidationOn", TEST_CATEGORY ) { } -TEST_CASE( "setValidationOff", TEST_CATEGORY ) { +TEST_CASE( "setQuESTValidationOff", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { // confirm always safe to call for (int i=0; i<3; i++) - REQUIRE_NOTHROW( setValidationOff() ); + REQUIRE_NOTHROW( setQuESTValidationOff() ); // prepare non-unitary matrix CompMatr1 m = getCompMatr1({{1,2},{3,4}}); @@ -420,7 +420,7 @@ TEST_CASE( "setValidationOff", TEST_CATEGORY ) { REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) ); // which otherwise triggers - setValidationOn(); + setQuESTValidationOn(); REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) ); destroyQureg(qureg); @@ -433,7 +433,7 @@ TEST_CASE( "setValidationOff", TEST_CATEGORY ) { } // ensure validation is on for remaining tests - setValidationOn(); + setQuESTValidationOn(); } From b96ccd4b4f96615be4f49584f56c7d63739f4fec Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:41:33 -0400 Subject: [PATCH 06/17] rename setValidationEpsilonToDefault --- quest/include/debug.h | 2 +- quest/include/modes.h | 2 +- quest/src/api/debug.cpp | 2 +- tests/unit/debug.cpp | 20 ++++++++++---------- tests/unit/operations.cpp | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/quest/include/debug.h b/quest/include/debug.h index 607d0162f..e78759aaf 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -91,7 +91,7 @@ void setQuESTValidationOff(); /// @notyetdoced -void setValidationEpsilonToDefault(); +void setQuESTValidationEpsilonToDefault(); /// @notyetdoced diff --git a/quest/include/modes.h b/quest/include/modes.h index f8fc52a1c..89a1c641e 100644 --- a/quest/include/modes.h +++ b/quest/include/modes.h @@ -56,7 +56,7 @@ * precision-specific default (`1E-5`, `1E-12`, `1E-13` for single, double and quadruple * precision respectively). The specified epsilon is used by QuEST for numerical validation * unless overriden at runtime via setValidationEpsilon(), in which case it can be - * restored to that specified by this environment variable using setValidationEpsilonToDefault(). + * restored to that specified by this environment variable using setQuESTValidationEpsilonToDefault(). * * @envvarvalues * - setting @p DEFAULT_VALIDATION_EPSILON=0 disables numerical validation, as if the value diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index e99fcd172..c5f500696 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -105,7 +105,7 @@ void setValidationEpsilon(qreal eps) { util_setEpsilonSensitiveHeapFlagsToUnknown(); } -void setValidationEpsilonToDefault() { +void setQuESTValidationEpsilonToDefault() { validate_envIsInit(__func__); validateconfig_setEpsilonToDefault(); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index ada1df044..127b4134e 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -544,7 +544,7 @@ TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { } // ensure validation epsilon is default for remaining tests - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); } @@ -572,18 +572,18 @@ TEST_CASE( "getValidationEpsilon", TEST_CATEGORY ) { } // ensure validation epsilon is default for remaining tests - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); } -TEST_CASE( "setValidationEpsilonToDefault", TEST_CATEGORY ) { +TEST_CASE( "setQuESTValidationEpsilonToDefault", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { SECTION( "always safe to call" ) { for (int i=0; i<3; i++) - REQUIRE_NOTHROW( setValidationEpsilonToDefault() ); + REQUIRE_NOTHROW( setQuESTValidationEpsilonToDefault() ); } SECTION( "affects validation" ) { @@ -600,7 +600,7 @@ TEST_CASE( "setValidationEpsilonToDefault", TEST_CATEGORY ) { REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) ); // which returns when stored to default - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) ); destroyQureg(qureg); @@ -614,7 +614,7 @@ TEST_CASE( "setValidationEpsilonToDefault", TEST_CATEGORY ) { *(m.isApproxUnitary) = 1; *(m.isApproxHermitian) = 1; - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); REQUIRE( *(m.isApproxUnitary) == -1 ); REQUIRE( *(m.isApproxHermitian) == -1 ); @@ -628,7 +628,7 @@ TEST_CASE( "setValidationEpsilonToDefault", TEST_CATEGORY ) { *(m.isApproxHermitian) = 0; *(m.isApproxNonZero) = 1; - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); REQUIRE( *(m.isApproxUnitary) == -1 ); REQUIRE( *(m.isApproxHermitian) == -1 ); REQUIRE( *(m.isApproxNonZero) == -1 ); @@ -643,7 +643,7 @@ TEST_CASE( "setValidationEpsilonToDefault", TEST_CATEGORY ) { *(m.isApproxHermitian) = 0; *(m.isApproxNonZero) = 1; - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); REQUIRE( *(m.isApproxUnitary) == -1 ); REQUIRE( *(m.isApproxHermitian) == -1 ); REQUIRE( *(m.isApproxNonZero) == -1 ); @@ -656,7 +656,7 @@ TEST_CASE( "setValidationEpsilonToDefault", TEST_CATEGORY ) { KrausMap k = createKrausMap(1, 3); *(k.isApproxCPTP) = 1; - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); REQUIRE( *(k.isApproxCPTP) == -1 ); destroyKrausMap(k); @@ -674,7 +674,7 @@ TEST_CASE( "setValidationEpsilonToDefault", TEST_CATEGORY ) { } // ensure validation epsilon is default for remaining tests - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); } diff --git a/tests/unit/operations.cpp b/tests/unit/operations.cpp index 0e33220db..b32438174 100644 --- a/tests/unit/operations.cpp +++ b/tests/unit/operations.cpp @@ -745,7 +745,7 @@ void testOperationCorrectness(auto operation, auto matrixRefGen) { // we re-implement 'input validation' checks which force us to fix thresholds (Args == compmatr)? setValidationEpsilon(0): - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); // prepare test function which will receive both statevectors and density matrices auto testFunc = [&](Qureg qureg, auto& stateRef) -> void { @@ -777,7 +777,7 @@ void testOperationCorrectness(auto operation, auto matrixRefGen) { // free any heap-alloated API matrices and restore epsilon freeRemainingArgs(furtherArgs); - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); } @@ -1830,7 +1830,7 @@ TEST_CASE( "applyForcedMultiQubitMeasurement", TEST_CATEGORY_OPS ) { SECTION( LABEL_STATEVEC ) { TEST_ON_CACHED_QUREGS(statevecQuregs, statevecRef, testFunc); } SECTION( LABEL_DENSMATR ) { TEST_ON_CACHED_QUREGS(densmatrQuregs, densmatrRef, testFunc); } - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); } SECTION( LABEL_VALIDATION ) { @@ -2313,7 +2313,7 @@ TEST_CASE( "applyFullStateDiagMatrPower", TEST_CATEGORY_OPS LABEL_MIXED_DEPLOY_T TEST_ON_CACHED_QUREG_AND_MATRIX( cachedDM, cachedMatrs, apiFunc, refDM, refMatr, refFunc); } - setValidationEpsilonToDefault(); + setQuESTValidationEpsilonToDefault(); } /// @todo input validation From 5c96a54691904570689d8b3048a21bf48ba75cf9 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:42:45 -0400 Subject: [PATCH 07/17] rename setValidationEpsilon --- docs/tutorial.md | 4 ++-- quest/include/calculations.h | 14 ++++++------- quest/include/debug.h | 2 +- quest/include/deprecated.h | 30 +++++++++++++-------------- quest/include/modes.h | 2 +- quest/include/operations.h | 4 ++-- quest/include/trotterisation.h | 10 ++++----- quest/src/api/debug.cpp | 2 +- tests/deprecated/test_decoherence.cpp | 2 +- tests/deprecated/test_unitaries.cpp | 4 ++-- tests/unit/debug.cpp | 20 +++++++++--------- tests/unit/operations.cpp | 6 +++--- tests/unit/trotterisation.cpp | 4 ++-- 13 files changed, 52 insertions(+), 52 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 4eb95eb02..8b41dc39e 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -193,7 +193,7 @@ setNumReportedNewlines(3); Perhaps we also wish to relax the [precision](https://quest-kit.github.io/QuEST/group__debug__validation.html#gae395568df6def76045ec1881fcb4e6d1) with which our future inputs will be asserted unitary or Hermitian ```cpp -setValidationEpsilon(0.001); +setQuESTValidationEpsilon(0.001); ``` but when unitarity _is_ violated, or we otherwise pass an invalid input, we wish to execute a [custom function](https://quest-kit.github.io/QuEST/group__debug__validation.html#ga14b6e7ce08465e36750da3acbc41062f) before exiting. ```cpp @@ -612,7 +612,7 @@ Exiting... If we're satisfied our matrix _is_ sufficiently approximately unitary, we can [adjust](https://quest-kit.github.io/QuEST/group__debug__validation.html#gae395568df6def76045ec1881fcb4e6d1) or [disable](https://quest-kit.github.io/QuEST/group__debug__validation.html#ga5999824df0785ea88fb2d5b5582f2b46) the validation. ```cpp // max(norm(m * dagger(m) - identity)) = 0.9025 -setValidationEpsilon(0.903); +setQuESTValidationEpsilon(0.903); applyCompMatr1(qureg, 0, m); ``` diff --git a/quest/include/calculations.h b/quest/include/calculations.h index 8043a3910..2ce813748 100644 --- a/quest/include/calculations.h +++ b/quest/include/calculations.h @@ -69,7 +69,7 @@ extern "C" { * * - Postcondition validation will check that the calculated expectation value is approximately * real (i.e. the imaginary component is smaller in size than the validation epsilon), as admitted - * when @p qureg is correctly normalised. This behaviour can be adjusted using setValidationEpsilon(). + * when @p qureg is correctly normalised. This behaviour can be adjusted using setQuESTValidationEpsilon(). * - Regardless of the validation epsilon, the returned value is always real and the imaginary component * is discarded. The full complex value can be obtained using calcExpecNonHermitianPauliStrSum(). * @@ -129,7 +129,7 @@ qreal calcExpecPauliStr(Qureg qureg, PauliStr str); * @f[ |\im{c}| \le \valeps * @f] - * for all @f$c \in @f$ `sum.coeffs`. Adjust @f$\valeps@f$ using setValidationEpsilon(). + * for all @f$c \in @f$ `sum.coeffs`. Adjust @f$\valeps@f$ using setQuESTValidationEpsilon(). * The sub-epsilon imaginary components of the coefficients _are_ included in calculation. * - Postcondition validation will check that the calculated expectation value is approximately * real (i.e. the imaginary component is smaller in size than the validation epsilon), as should be @@ -201,7 +201,7 @@ qreal calcExpecPauliStrSum(Qureg qureg, PauliStrSum sum); * @f[ |\im{c}| \le \valeps * @f] - * for all @f$c \in @f$ `matr.cpuElems`. Adjust @f$\valeps@f$ using setValidationEpsilon(). + * for all @f$c \in @f$ `matr.cpuElems`. Adjust @f$\valeps@f$ using setQuESTValidationEpsilon(). * - Postcondition validation will check that the calculated expectation value is approximately * real (i.e. the imaginary component is smaller in size than the validation epsilon), as should be * admitted when @p qureg is correctly normalised, and @p matr is Hermitian. @@ -277,7 +277,7 @@ qreal calcExpecFullStateDiagMatr(Qureg qureg, FullStateDiagMatr matr); * @f[ |\im{c}| \le \valeps * @f] - * for all @f$c \in @f$ `matr.cpuElems`. Adjust @f$\valeps@f$ using setValidationEpsilon(). + * for all @f$c \in @f$ `matr.cpuElems`. Adjust @f$\valeps@f$ using setQuESTValidationEpsilon(). * * > [!CAUTION] * > Unlike other functions (including calcExpecFullStateDiagMatr()), this function will _NOT_ @@ -298,7 +298,7 @@ qreal calcExpecFullStateDiagMatr(Qureg qureg, FullStateDiagMatr matr); * zero elements which would otherwise create divergences in @f$\hat{D}^x@f$. Validation ergo * checks that when @p exponent is (strictly) negative, @p matrix contains no elements within * distance @f$\valeps@f$ to zero (regardless of the magnitude of @p exponent). Adjust - * @f$\valeps@f$ using setValidationEpsilon(). + * @f$\valeps@f$ using setQuESTValidationEpsilon(). * - The passed @p exponent is always real, but can be relaxed to a general complex scalar via * calcExpecNonHermitianFullStateDiagMatrPower(). * - The returned value is always real, and the imaginary component is neglected even when @@ -890,7 +890,7 @@ qreal calcPurity(Qureg qureg); * - The output of this function is always real, which validation will check after computing the * fidelity as a complex scalar. Specifically, validation will assert that the result has an * absolute imaginary component less than the validation epsilon, which can be adjusted with - * setValidationEpsilon(). + * setQuESTValidationEpsilon(). * * - This function does not yet support both @p qureg and @p other being density matrices, for * which the fidelity calculation is more substantial. @@ -1004,7 +1004,7 @@ qreal calcFidelity(Qureg qureg, Qureg other); \left| \, \im{ \brapsi \dmrho \svpsi } \, \right| \le \valeps, \\ \re{ \brapsi \dmrho \svpsi } \le 1 + \valeps, * @f] - * where @f$\valeps@f$ is the validation epsilon, adjustable via setValidationEpsilon(). + * where @f$\valeps@f$ is the validation epsilon, adjustable via setQuESTValidationEpsilon(). * * - Even when the above postcondition validation is disabled, the Bures and purified distance * calculations will respectively replace @f$\left| \braket{\phi}{\psi} \right|@f$ and diff --git a/quest/include/debug.h b/quest/include/debug.h index e78759aaf..80634b69b 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -95,7 +95,7 @@ void setQuESTValidationEpsilonToDefault(); /// @notyetdoced -void setValidationEpsilon(qreal eps); +void setQuESTValidationEpsilon(qreal eps); /// @notyetdoced diff --git a/quest/include/deprecated.h b/quest/include/deprecated.h index 6461946fa..f19532c70 100644 --- a/quest/include/deprecated.h +++ b/quest/include/deprecated.h @@ -658,9 +658,9 @@ static inline void v3_mixKrausMap(Qureg qureg, int targ, _NoWarnComplexMatrix2 * static inline void _mixNonTPKrausMap(Qureg qureg, int targ, _NoWarnComplexMatrix2 *ops, int numOps) { qreal eps = getValidationEpsilon(); - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); _MIX_KRAUS_MAP_INNER(qureg, ops, numOps, &targ, 1); - setValidationEpsilon(eps); + setQuESTValidationEpsilon(eps); } #define mixNonTPKrausMap(...) \ @@ -674,9 +674,9 @@ static inline void _mixNonTPKrausMap(Qureg qureg, int targ, _NoWarnComplexMatrix static inline void _mixTwoQubitKrausMap(Qureg qureg, int targ1, int targ2, _NoWarnComplexMatrix4 *ops, int numOps, int isNonCPTP) { int targs[] = {targ1, targ2}; qreal eps = getValidationEpsilon(); - if (isNonCPTP) setValidationEpsilon(0); + if (isNonCPTP) setQuESTValidationEpsilon(0); _MIX_KRAUS_MAP_INNER(qureg, ops, numOps, targs, 2); - setValidationEpsilon(eps); + setQuESTValidationEpsilon(eps); } #define mixTwoQubitKrausMap(...) \ @@ -704,10 +704,10 @@ static inline void _mixMultiQubitKrausMap(Qureg qureg, int* targs, int numTargs, free(ptrs); qreal eps = getValidationEpsilon(); - if (isNonCPTP) setValidationEpsilon(0); + if (isNonCPTP) setQuESTValidationEpsilon(0); (mixKrausMap)(qureg, targs, numTargs, map); // calls above macro, wrapped to avoid warning */ destroyKrausMap(map); - setValidationEpsilon(eps); + setQuESTValidationEpsilon(eps); } #define mixMultiQubitKrausMap(...) \ @@ -828,14 +828,14 @@ static inline QuESTEnv _createQuESTEnv() { static inline void _applyGateSubDiagonalOp(Qureg qureg, int* targets, int numTargets, DiagMatr op) { qreal eps = getValidationEpsilon(); - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); applyDiagMatr(qureg, targets, numTargets, op); - setValidationEpsilon(eps); + setQuESTValidationEpsilon(eps); } #define applyGateSubDiagonalOp(...) \ _WARN_GENERAL_MSG( \ "The QuEST function 'applyGateSubDiagonalOp()' is deprecated. To achieve the same thing, disable " \ - "numerical validation via 'setValidationEpsilon(0)' before calling 'applyDiagMatr()'. You can " \ + "numerical validation via 'setQuESTValidationEpsilon(0)' before calling 'applyDiagMatr()'. You can " \ "save the existing epsilon via 'getValidationEpsilon()' to thereafter restore. This procedure " \ "has been performed here automatically.") \ _applyGateSubDiagonalOp(__VA_ARGS__) @@ -1132,30 +1132,30 @@ static inline void _applyPauliHamil(Qureg inQureg, PauliStrSum hamil, Qureg outQ static inline void _applyGateMatrixN(Qureg qureg, int* targs, int numTargs, CompMatr u) { qreal eps = getValidationEpsilon(); - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); applyCompMatr(qureg, targs, numTargs, u); - setValidationEpsilon(eps); + setQuESTValidationEpsilon(eps); } #define applyGateMatrixN(...) \ _WARN_GENERAL_MSG( \ "The QuEST function 'applyGateMatrixN()' is deprecated. To achieve the same thing, disable " \ - "numerical validation via 'setValidationEpsilon(0)' before calling 'applyCompMatr()'. You can " \ + "numerical validation via 'setQuESTValidationEpsilon(0)' before calling 'applyCompMatr()'. You can " \ "save the existing epsilon via 'getValidationEpsilon()' to thereafter restore. This procedure " \ "has been performed here automatically.") \ _applyGateMatrixN(__VA_ARGS__) static inline void _applyMultiControlledGateMatrixN(Qureg qureg, int* ctrls, int numCtrls, int* targs, int numTargs, CompMatr u) { qreal eps = getValidationEpsilon(); - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); applyMultiControlledCompMatr(qureg, ctrls, numCtrls, targs, numTargs, u); - setValidationEpsilon(eps); + setQuESTValidationEpsilon(eps); } #define applyMultiControlledGateMatrixN(...) \ _WARN_GENERAL_MSG( \ "The QuEST function 'applyMultiControlledGateMatrixN()' is deprecated. To achieve the same thing, disable " \ - "numerical validation via 'setValidationEpsilon(0)' before calling 'applyMultiControlledCompMatr()'. You can " \ + "numerical validation via 'setQuESTValidationEpsilon(0)' before calling 'applyMultiControlledCompMatr()'. You can " \ "save the existing epsilon via 'getValidationEpsilon()' to thereafter restore. This procedure has been " \ "performed here automatically.") \ _applyMultiControlledGateMatrixN(__VA_ARGS__) diff --git a/quest/include/modes.h b/quest/include/modes.h index 89a1c641e..30441009d 100644 --- a/quest/include/modes.h +++ b/quest/include/modes.h @@ -55,7 +55,7 @@ * Specifying `DEFAULT_VALIDATION_EPSILON` to a positive, real number overrides the * precision-specific default (`1E-5`, `1E-12`, `1E-13` for single, double and quadruple * precision respectively). The specified epsilon is used by QuEST for numerical validation - * unless overriden at runtime via setValidationEpsilon(), in which case it can be + * unless overriden at runtime via setQuESTValidationEpsilon(), in which case it can be * restored to that specified by this environment variable using setQuESTValidationEpsilonToDefault(). * * @envvarvalues diff --git a/quest/include/operations.h b/quest/include/operations.h index ea4a316ae..ff81ad7aa 100644 --- a/quest/include/operations.h +++ b/quest/include/operations.h @@ -95,7 +95,7 @@ digraph { * @f[ \max\limits_{ij} \Big|\left(\hat{U} \hat{U}^\dagger - \id\right)_{ij}\Big|^2 \le \valeps * @f] - * where the validation epsilon @f$ \valeps @f$ can be adjusted with setValidationEpsilon(). + * where the validation epsilon @f$ \valeps @f$ can be adjusted with setQuESTValidationEpsilon(). * * @myexample * ``` @@ -194,7 +194,7 @@ digraph { * @f[ \max\limits_{ij} \Big|\left(\hat{U} \hat{U}^\dagger - \id\right)_{ij}\Big|^2 \le \valeps * @f] - * where the validation epsilon @f$ \valeps @f$ can be adjusted with setValidationEpsilon(). + * where the validation epsilon @f$ \valeps @f$ can be adjusted with setQuESTValidationEpsilon(). * * @equivalences * diff --git a/quest/include/trotterisation.h b/quest/include/trotterisation.h index 6fd493264..59600c9d9 100644 --- a/quest/include/trotterisation.h +++ b/quest/include/trotterisation.h @@ -138,7 +138,7 @@ extern "C" { * @f[ \max\limits_{i} |c_i| \le \valeps * @f] - * where the validation epsilon @f$ \valeps @f$ can be adjusted with setValidationEpsilon(). + * where the validation epsilon @f$ \valeps @f$ can be adjusted with setQuESTValidationEpsilon(). * Otherwise, use applyTrotterizedNonUnitaryPauliStrSumGadget() to permit non-Hermitian @p sum * and ergo effect a non-unitary exponential(s). * @@ -352,7 +352,7 @@ extern "C" { * @f[ \max\limits_{i} |c_i| \le \valeps * @f] - * where the validation epsilon @f$ \valeps @f$ can be adjusted with setValidationEpsilon(). The imaginary components + * where the validation epsilon @f$ \valeps @f$ can be adjusted with setQuESTValidationEpsilon(). The imaginary components * of the Hamiltonian _are_ considered during simulation. * * - The @p time parameter is necessarily real to retain unitarity. It can be substituted for a strictly imaginary @@ -488,7 +488,7 @@ void applyTrotterizedUnitaryTimeEvolution(Qureg qureg, PauliStrSum hamil, qreal * @f[ \max\limits_{i} |c_i| \le \valeps * @f] - * where the validation epsilon @f$ \valeps @f$ can be adjusted with setValidationEpsilon(). Beware however that + * where the validation epsilon @f$ \valeps @f$ can be adjusted with setQuESTValidationEpsilon(). Beware however that * imaginary-time evolution under a non-Hermitian Hamiltonian will _not_ necessarily approach the lowest lying eigenstate * (the eigenvalues may be non-real) so is likely of limited utility. * @@ -604,8 +604,8 @@ void applyTrotterizedImaginaryTimeEvolution(Qureg qureg, PauliStrSum hamil, qrea * @f[ \min\limits_{i} \gamma_i \ge - \valeps * @f] - * where the validation epsilon @f$ \valeps @f$ can be adjusted with setValidationEpsilon(). Non-trace-preserving, - * negative damping rates can be simulated by disabling numerical validation via `setValidationEpsilon(0)`. + * where the validation epsilon @f$ \valeps @f$ can be adjusted with setQuESTValidationEpsilon(). Non-trace-preserving, + * negative damping rates can be simulated by disabling numerical validation via `setQuESTValidationEpsilon(0)`. * * - The @p time parameter is necessarily real, and cannot be generalised to imaginary or complex like in other * functions. Generalisation is trivially numerically possible, but has no established physical meaning and so diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index c5f500696..504ebfd68 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -97,7 +97,7 @@ void setQuESTValidationOff() { } -void setValidationEpsilon(qreal eps) { +void setQuESTValidationEpsilon(qreal eps) { validate_envIsInit(__func__); validate_newEpsilonValue(eps, __func__); diff --git a/tests/deprecated/test_decoherence.cpp b/tests/deprecated/test_decoherence.cpp index edf1d9f61..d4a626d47 100644 --- a/tests/deprecated/test_decoherence.cpp +++ b/tests/deprecated/test_decoherence.cpp @@ -32,7 +32,7 @@ using std::vector; initDebugState(qureg); \ QMatrix ref = toQMatrix(qureg); \ assertQuregAndRefInDebugState(qureg, ref); \ - setValidationEpsilon(REAL_EPS); + setQuESTValidationEpsilon(REAL_EPS); /* allows concise use of ContainsSubstring in catch's REQUIRE_THROWS_WITH */ using Catch::Matchers::ContainsSubstring; diff --git a/tests/deprecated/test_unitaries.cpp b/tests/deprecated/test_unitaries.cpp index f0bb2f5aa..6cfd9e803 100644 --- a/tests/deprecated/test_unitaries.cpp +++ b/tests/deprecated/test_unitaries.cpp @@ -31,13 +31,13 @@ QMatrix refMatr = toQMatrix(quregMatr); \ assertQuregAndRefInDebugState(quregVec, refVec); \ assertQuregAndRefInDebugState(quregMatr, refMatr); \ - setValidationEpsilon(REAL_EPS); + setQuESTValidationEpsilon(REAL_EPS); /** Destroys the data structures made by PREPARE_TEST */ #define CLEANUP_TEST(quregVec, quregMatr) \ destroyQureg(quregVec); \ destroyQureg(quregMatr); \ - setValidationEpsilon(REAL_EPS); + setQuESTValidationEpsilon(REAL_EPS); /* allows concise use of ContainsSubstring in catch's REQUIRE_THROWS_WITH */ using Catch::Matchers::ContainsSubstring; diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 127b4134e..80f7140f6 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -437,7 +437,7 @@ TEST_CASE( "setQuESTValidationOff", TEST_CATEGORY ) { } -TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { +TEST_CASE( "setQuESTValidationEpsilon", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { @@ -454,14 +454,14 @@ TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) ); // confirm setting = 0 disables epsilon errors... - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) ); // but does not disable absolute errors REQUIRE_THROWS( applyCompMatr1(qureg, -1, m) ); // confirm non-zero (forgive all) works - setValidationEpsilon(9999); // bigger than dist of m*conj(m) from identity squared + setQuESTValidationEpsilon(9999); // bigger than dist of m*conj(m) from identity squared REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) ); } @@ -483,7 +483,7 @@ TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { *(m.isApproxUnitary) = 1; *(m.isApproxHermitian) = 1; - setValidationEpsilon(.1); + setQuESTValidationEpsilon(.1); REQUIRE( *(m.isApproxUnitary) == -1 ); REQUIRE( *(m.isApproxHermitian) == -1 ); @@ -497,7 +497,7 @@ TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { *(m.isApproxHermitian) = 0; *(m.isApproxNonZero) = 1; - setValidationEpsilon(.1); + setQuESTValidationEpsilon(.1); REQUIRE( *(m.isApproxUnitary) == -1 ); REQUIRE( *(m.isApproxHermitian) == -1 ); REQUIRE( *(m.isApproxNonZero) == -1 ); @@ -512,7 +512,7 @@ TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { *(m.isApproxHermitian) = 0; *(m.isApproxNonZero) = 1; - setValidationEpsilon(.1); + setQuESTValidationEpsilon(.1); REQUIRE( *(m.isApproxUnitary) == -1 ); REQUIRE( *(m.isApproxHermitian) == -1 ); REQUIRE( *(m.isApproxNonZero) == -1 ); @@ -525,7 +525,7 @@ TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { KrausMap k = createKrausMap(1, 3); *(k.isApproxCPTP) = 1; - setValidationEpsilon(.1); + setQuESTValidationEpsilon(.1); REQUIRE( *(k.isApproxCPTP) == -1 ); destroyKrausMap(k); @@ -539,7 +539,7 @@ TEST_CASE( "setValidationEpsilon", TEST_CATEGORY ) { qreal eps = GENERATE( -0.5, -1, -100 ); - REQUIRE_THROWS_WITH( setValidationEpsilon(eps), ContainsSubstring("positive number") ); + REQUIRE_THROWS_WITH( setQuESTValidationEpsilon(eps), ContainsSubstring("positive number") ); } } @@ -560,7 +560,7 @@ TEST_CASE( "getValidationEpsilon", TEST_CATEGORY ) { // confirm set correctly qreal eps = getRandomReal(0, 99999); - setValidationEpsilon(eps); + setQuESTValidationEpsilon(eps); REQUIRE( getValidationEpsilon() == eps ); } @@ -596,7 +596,7 @@ TEST_CASE( "setQuESTValidationEpsilonToDefault", TEST_CATEGORY ) { REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) ); // confirm setting = 0 disables epsilon errors... - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) ); // which returns when stored to default diff --git a/tests/unit/operations.cpp b/tests/unit/operations.cpp index b32438174..fac184d3a 100644 --- a/tests/unit/operations.cpp +++ b/tests/unit/operations.cpp @@ -744,7 +744,7 @@ void testOperationCorrectness(auto operation, auto matrixRefGen) { // upon few qubits are single-precision. So we disable completely until // we re-implement 'input validation' checks which force us to fix thresholds (Args == compmatr)? - setValidationEpsilon(0): + setQuESTValidationEpsilon(0): setQuESTValidationEpsilonToDefault(); // prepare test function which will receive both statevectors and density matrices @@ -1806,7 +1806,7 @@ TEST_CASE( "applyForcedMultiQubitMeasurement", TEST_CATEGORY_OPS ) { // this test may randomly request a measurement outcome which // is illegally unlikely, triggering validation; we merely // disable such validation and hope divergences don't break the test! - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); auto testFunc = [&](Qureg qureg, auto& ref) { @@ -2291,7 +2291,7 @@ TEST_CASE( "applyFullStateDiagMatrPower", TEST_CATEGORY_OPS LABEL_MIXED_DEPLOY_T GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) ); if (!testRealExp) - setValidationEpsilon(0); + setQuESTValidationEpsilon(0); SECTION( LABEL_STATEVEC ) { diff --git a/tests/unit/trotterisation.cpp b/tests/unit/trotterisation.cpp index 5e264ad53..0b155c42b 100644 --- a/tests/unit/trotterisation.cpp +++ b/tests/unit/trotterisation.cpp @@ -269,7 +269,7 @@ TEST_CASE( "applyTrotterizedUnitaryTimeEvolution", TEST_CATEGORY ) { // - 1E-12 at double precision // - 1E-13 at quad precision qreal initialValidationEps = getValidationEpsilon(); - setValidationEpsilon(2 * initialValidationEps); + setQuESTValidationEpsilon(2 * initialValidationEps); const int NUM_QUBITS = 8; qreal dt = 0.1; @@ -331,7 +331,7 @@ TEST_CASE( "applyTrotterizedUnitaryTimeEvolution", TEST_CATEGORY ) { } // Restore validation epsilon - setValidationEpsilon(initialValidationEps); + setQuESTValidationEpsilon(initialValidationEps); destroyPauliStrSum(hamil); destroyPauliStrSum(observ); From 0c4a1f71620a4864135e3487fd82584e6eaf8cf9 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:43:30 -0400 Subject: [PATCH 08/17] rename getValidationEpsilon --- quest/include/debug.h | 2 +- quest/include/deprecated.h | 18 +++++++++--------- quest/src/api/debug.cpp | 2 +- tests/unit/debug.cpp | 6 +++--- tests/unit/operations.cpp | 10 +++++----- tests/unit/trotterisation.cpp | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/quest/include/debug.h b/quest/include/debug.h index 80634b69b..59c9562de 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -99,7 +99,7 @@ void setQuESTValidationEpsilon(qreal eps); /// @notyetdoced -qreal getValidationEpsilon(); +qreal getQuESTValidationEpsilon(); /** @} */ diff --git a/quest/include/deprecated.h b/quest/include/deprecated.h index f19532c70..f505a5874 100644 --- a/quest/include/deprecated.h +++ b/quest/include/deprecated.h @@ -657,7 +657,7 @@ static inline void v3_mixKrausMap(Qureg qureg, int targ, _NoWarnComplexMatrix2 * static inline void _mixNonTPKrausMap(Qureg qureg, int targ, _NoWarnComplexMatrix2 *ops, int numOps) { - qreal eps = getValidationEpsilon(); + qreal eps = getQuESTValidationEpsilon(); setQuESTValidationEpsilon(0); _MIX_KRAUS_MAP_INNER(qureg, ops, numOps, &targ, 1); setQuESTValidationEpsilon(eps); @@ -673,7 +673,7 @@ static inline void _mixNonTPKrausMap(Qureg qureg, int targ, _NoWarnComplexMatrix static inline void _mixTwoQubitKrausMap(Qureg qureg, int targ1, int targ2, _NoWarnComplexMatrix4 *ops, int numOps, int isNonCPTP) { int targs[] = {targ1, targ2}; - qreal eps = getValidationEpsilon(); + qreal eps = getQuESTValidationEpsilon(); if (isNonCPTP) setQuESTValidationEpsilon(0); _MIX_KRAUS_MAP_INNER(qureg, ops, numOps, targs, 2); setQuESTValidationEpsilon(eps); @@ -703,7 +703,7 @@ static inline void _mixMultiQubitKrausMap(Qureg qureg, int* targs, int numTargs, setKrausMap(map, ptrs); free(ptrs); - qreal eps = getValidationEpsilon(); + qreal eps = getQuESTValidationEpsilon(); if (isNonCPTP) setQuESTValidationEpsilon(0); (mixKrausMap)(qureg, targs, numTargs, map); // calls above macro, wrapped to avoid warning */ destroyKrausMap(map); @@ -827,7 +827,7 @@ static inline QuESTEnv _createQuESTEnv() { leftapplyDiagMatr(__VA_ARGS__) static inline void _applyGateSubDiagonalOp(Qureg qureg, int* targets, int numTargets, DiagMatr op) { - qreal eps = getValidationEpsilon(); + qreal eps = getQuESTValidationEpsilon(); setQuESTValidationEpsilon(0); applyDiagMatr(qureg, targets, numTargets, op); setQuESTValidationEpsilon(eps); @@ -836,7 +836,7 @@ static inline void _applyGateSubDiagonalOp(Qureg qureg, int* targets, int numTar _WARN_GENERAL_MSG( \ "The QuEST function 'applyGateSubDiagonalOp()' is deprecated. To achieve the same thing, disable " \ "numerical validation via 'setQuESTValidationEpsilon(0)' before calling 'applyDiagMatr()'. You can " \ - "save the existing epsilon via 'getValidationEpsilon()' to thereafter restore. This procedure " \ + "save the existing epsilon via 'getQuESTValidationEpsilon()' to thereafter restore. This procedure " \ "has been performed here automatically.") \ _applyGateSubDiagonalOp(__VA_ARGS__) @@ -1131,7 +1131,7 @@ static inline void _applyPauliHamil(Qureg inQureg, PauliStrSum hamil, Qureg outQ static inline void _applyGateMatrixN(Qureg qureg, int* targs, int numTargs, CompMatr u) { - qreal eps = getValidationEpsilon(); + qreal eps = getQuESTValidationEpsilon(); setQuESTValidationEpsilon(0); applyCompMatr(qureg, targs, numTargs, u); setQuESTValidationEpsilon(eps); @@ -1141,12 +1141,12 @@ static inline void _applyGateMatrixN(Qureg qureg, int* targs, int numTargs, Comp _WARN_GENERAL_MSG( \ "The QuEST function 'applyGateMatrixN()' is deprecated. To achieve the same thing, disable " \ "numerical validation via 'setQuESTValidationEpsilon(0)' before calling 'applyCompMatr()'. You can " \ - "save the existing epsilon via 'getValidationEpsilon()' to thereafter restore. This procedure " \ + "save the existing epsilon via 'getQuESTValidationEpsilon()' to thereafter restore. This procedure " \ "has been performed here automatically.") \ _applyGateMatrixN(__VA_ARGS__) static inline void _applyMultiControlledGateMatrixN(Qureg qureg, int* ctrls, int numCtrls, int* targs, int numTargs, CompMatr u) { - qreal eps = getValidationEpsilon(); + qreal eps = getQuESTValidationEpsilon(); setQuESTValidationEpsilon(0); applyMultiControlledCompMatr(qureg, ctrls, numCtrls, targs, numTargs, u); setQuESTValidationEpsilon(eps); @@ -1156,7 +1156,7 @@ static inline void _applyMultiControlledGateMatrixN(Qureg qureg, int* ctrls, int _WARN_GENERAL_MSG( \ "The QuEST function 'applyMultiControlledGateMatrixN()' is deprecated. To achieve the same thing, disable " \ "numerical validation via 'setQuESTValidationEpsilon(0)' before calling 'applyMultiControlledCompMatr()'. You can " \ - "save the existing epsilon via 'getValidationEpsilon()' to thereafter restore. This procedure has been " \ + "save the existing epsilon via 'getQuESTValidationEpsilon()' to thereafter restore. This procedure has been " \ "performed here automatically.") \ _applyMultiControlledGateMatrixN(__VA_ARGS__) diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 504ebfd68..37bd20bcd 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -112,7 +112,7 @@ void setQuESTValidationEpsilonToDefault() { util_setEpsilonSensitiveHeapFlagsToUnknown(); } -qreal getValidationEpsilon() { +qreal getQuESTValidationEpsilon() { validate_envIsInit(__func__); return validateconfig_getEpsilon(); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 80f7140f6..cd1fbea37 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -548,13 +548,13 @@ TEST_CASE( "setQuESTValidationEpsilon", TEST_CATEGORY ) { } -TEST_CASE( "getValidationEpsilon", TEST_CATEGORY ) { +TEST_CASE( "getQuESTValidationEpsilon", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { // confirm always safe to call for (int i=0; i<3; i++) - REQUIRE_NOTHROW( getValidationEpsilon() ); // ignores output + REQUIRE_NOTHROW( getQuESTValidationEpsilon() ); // ignores output GENERATE( range(0,10) ); @@ -562,7 +562,7 @@ TEST_CASE( "getValidationEpsilon", TEST_CATEGORY ) { qreal eps = getRandomReal(0, 99999); setQuESTValidationEpsilon(eps); - REQUIRE( getValidationEpsilon() == eps ); + REQUIRE( getQuESTValidationEpsilon() == eps ); } SECTION( LABEL_VALIDATION ) { diff --git a/tests/unit/operations.cpp b/tests/unit/operations.cpp index fac184d3a..80b75b9c2 100644 --- a/tests/unit/operations.cpp +++ b/tests/unit/operations.cpp @@ -1724,8 +1724,8 @@ TEST_CASE( "applyForcedQubitMeasurement", TEST_CATEGORY_OPS ) { // below validation tests assume qubit 0 can collapse to either outcome // (which does not require normalisation; qureg can be in the debug state) initDebugState(qureg); - REQUIRE( calcProbOfQubitOutcome(qureg, 0, 0) > getValidationEpsilon() ); - REQUIRE( calcProbOfQubitOutcome(qureg, 0, 1) > getValidationEpsilon() ); + REQUIRE( calcProbOfQubitOutcome(qureg, 0, 0) > getQuESTValidationEpsilon() ); + REQUIRE( calcProbOfQubitOutcome(qureg, 0, 1) > getQuESTValidationEpsilon() ); SECTION( "qureg uninitialised" ) { @@ -1778,7 +1778,7 @@ TEST_CASE( "applyForcedQubitMeasurement", TEST_CATEGORY_OPS ) { qreal goodTheta = 0.1; applyRotateX(qureg, 0, goodTheta); REQUIRE( - calcProbOfQubitOutcome(qureg, 0, badOutcome) > getValidationEpsilon() + calcProbOfQubitOutcome(qureg, 0, badOutcome) > getQuESTValidationEpsilon() ); REQUIRE_NOTHROW( applyForcedQubitMeasurement(qureg, 0, badOutcome) @@ -1842,7 +1842,7 @@ TEST_CASE( "applyForcedMultiQubitMeasurement", TEST_CATEGORY_OPS ) { // below validation tests assume the above parameters are valid (not impossibly unlikely) initDebugState(qureg); - REQUIRE( calcProbOfMultiQubitOutcome(qureg, targets, outcomes, numTargets) > getValidationEpsilon() ); + REQUIRE( calcProbOfMultiQubitOutcome(qureg, targets, outcomes, numTargets) > getQuESTValidationEpsilon() ); SECTION( "qureg uninitialised" ) { @@ -1920,7 +1920,7 @@ TEST_CASE( "applyForcedMultiQubitMeasurement", TEST_CATEGORY_OPS ) { applyRotateX(qureg, targets[2], goodTheta); int goodOutcomes[] = {0, 0, 1}; REQUIRE( - calcProbOfMultiQubitOutcome(qureg, targets, goodOutcomes, numTargets) > getValidationEpsilon() + calcProbOfMultiQubitOutcome(qureg, targets, goodOutcomes, numTargets) > getQuESTValidationEpsilon() ); REQUIRE_NOTHROW( applyForcedMultiQubitMeasurement(qureg, targets, goodOutcomes, numTargets) diff --git a/tests/unit/trotterisation.cpp b/tests/unit/trotterisation.cpp index 0b155c42b..216d5e8d8 100644 --- a/tests/unit/trotterisation.cpp +++ b/tests/unit/trotterisation.cpp @@ -268,7 +268,7 @@ TEST_CASE( "applyTrotterizedUnitaryTimeEvolution", TEST_CATEGORY ) { // - 1E-5 at single precision // - 1E-12 at double precision // - 1E-13 at quad precision - qreal initialValidationEps = getValidationEpsilon(); + qreal initialValidationEps = getQuESTValidationEpsilon(); setQuESTValidationEpsilon(2 * initialValidationEps); const int NUM_QUBITS = 8; From ddd6684c6692e920aedbe9591ce1a8f5c3e227e2 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:44:31 -0400 Subject: [PATCH 09/17] rename setMaxNumReportedItems --- docs/tutorial.md | 6 +++--- examples/extended/dynamics.c | 6 +++--- examples/extended/dynamics.cpp | 6 +++--- examples/isolated/reporting_matrices.c | 6 +++--- examples/isolated/reporting_matrices.cpp | 6 +++--- examples/isolated/reporting_paulis.c | 2 +- examples/isolated/reporting_paulis.cpp | 2 +- quest/include/debug.h | 2 +- quest/src/api/debug.cpp | 2 +- tests/unit/debug.cpp | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 8b41dc39e..b5a316d4a 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -183,7 +183,7 @@ We may wish further to [adjust](https://quest-kit.github.io/QuEST/group__debug__ ```cpp int maxRows = 8; int maxCols = 4; -setMaxNumReportedItems(maxRows, maxCols); +setQuESTMaxNumReportedItems(maxRows, maxCols); setMaxNumReportedSigFigs(3); ``` or [add](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga29413703d609254244d6b13c663e6e06) extra spacing between QuEST's printed outputs @@ -253,7 +253,7 @@ Qureg (10 qubit statevector, 1024 qcomps, 16.1 KiB): 0 |1022⟩ 0 |1023⟩ ``` -> This printed only `8` amplitudes as per our setting of [`setMaxNumReportedItems()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga093c985b1970a0fd8616c01b9825979a) above. +> This printed only `8` amplitudes as per our setting of [`setQuESTMaxNumReportedItems()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga093c985b1970a0fd8616c01b9825979a) above. Behind the scenes, the function `createQureg` did something clever; it consulted the compiled deployments and available hardware to decide whether to distribute `qureg`, or dedicate it persistent GPU memory, and marked whether or not to multithread its subsequent modification. It attempts to choose _optimally_, avoiding gratuitous parallelisation if the overheads outweigh the benefits, or if the hardware devices have insufficient memory. @@ -805,7 +805,7 @@ PauliStrSum (4 terms, 160 bytes): ``` All outputs are affected by the [reporter settings](https://quest-kit.github.io/QuEST/group__debug__reporting.html). ```cpp -setMaxNumReportedItems(4,4); +setQuESTMaxNumReportedItems(4,4); setMaxNumReportedSigFigs(1); reportCompMatr(bigmatrix); ``` diff --git a/examples/extended/dynamics.c b/examples/extended/dynamics.c index 03abcc16c..b26a1ba36 100644 --- a/examples/extended/dynamics.c +++ b/examples/extended/dynamics.c @@ -107,12 +107,12 @@ void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setNumReportedNewlines(2); // spacing between reports setReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) - setMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes + setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes reportStr("[Initial state]"); reportQureg(qureg); - setMaxNumReportedItems(0, 0); // show 0=all Pauli operators + setQuESTMaxNumReportedItems(0, 0); // show 0=all Pauli operators reportStr("[Hamiltonian]"); reportPauliStrSum(hamil); @@ -173,7 +173,7 @@ int main() { // preview the final state... setNumReportedNewlines(2); - setMaxNumReportedItems(25, 25); + setQuESTMaxNumReportedItems(25, 25); reportStr("[Final state]"); reportQureg(qureg); diff --git a/examples/extended/dynamics.cpp b/examples/extended/dynamics.cpp index 636145387..3e0af1fca 100644 --- a/examples/extended/dynamics.cpp +++ b/examples/extended/dynamics.cpp @@ -104,12 +104,12 @@ void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setNumReportedNewlines(2); // spacing between reports setReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) - setMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes + setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes reportStr("[Initial state]"); reportQureg(qureg); - setMaxNumReportedItems(0, 0); // show 0=all Pauli operators + setQuESTMaxNumReportedItems(0, 0); // show 0=all Pauli operators reportStr("[Hamiltonian]"); reportPauliStrSum(hamil); @@ -167,7 +167,7 @@ int main() { // preview the final state... setNumReportedNewlines(2); - setMaxNumReportedItems(25, 25); + setQuESTMaxNumReportedItems(25, 25); reportStr("[Final state]"); reportQureg(qureg); diff --git a/examples/isolated/reporting_matrices.c b/examples/isolated/reporting_matrices.c index 319c758cb..cb497593e 100644 --- a/examples/isolated/reporting_matrices.c +++ b/examples/isolated/reporting_matrices.c @@ -49,7 +49,7 @@ void demo_CompMatr() { for (int i=0; i Date: Mon, 18 May 2026 22:44:49 -0400 Subject: [PATCH 10/17] rename setMaxNumReportedSigFigs --- docs/tutorial.md | 8 ++++---- examples/extended/dynamics.c | 4 ++-- examples/extended/dynamics.cpp | 4 ++-- quest/include/debug.h | 2 +- quest/src/api/debug.cpp | 2 +- tests/unit/debug.cpp | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index b5a316d4a..c61d5013f 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -184,7 +184,7 @@ We may wish further to [adjust](https://quest-kit.github.io/QuEST/group__debug__ int maxRows = 8; int maxCols = 4; setQuESTMaxNumReportedItems(maxRows, maxCols); -setMaxNumReportedSigFigs(3); +setQuESTMaxNumReportedSigFigs(3); ``` or [add](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga29413703d609254244d6b13c663e6e06) extra spacing between QuEST's printed outputs ```cpp @@ -415,7 +415,7 @@ Qureg (5 qubit density matrix, 32x32 qcomps, 16.1 KiB): -0.00597-0.00615i -0.00207-0.00451i … 0.000509-0.00401i 0.0173+(3.12e-19)i ``` -> The number of printed significant figures above results from our earlier calling of [`setMaxNumReportedSigFigs()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga15d46e5d813f70b587762814964e1994). +> The number of printed significant figures above results from our earlier calling of [`setQuESTMaxNumReportedSigFigs()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga15d46e5d813f70b587762814964e1994). @@ -783,7 +783,7 @@ reportScalar("entanglement", calcPurity(reduced)); ## Report the results -We've seen above that [scalars](https://quest-kit.github.io/QuEST/group__types.html) can be reported, handling the pretty formatting of real and complex numbers, controlled by settings like [`setMaxNumReportedSigFigs()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga15d46e5d813f70b587762814964e1994). But we can also report every data structure in the QuEST API, such as Pauli strings +We've seen above that [scalars](https://quest-kit.github.io/QuEST/group__types.html) can be reported, handling the pretty formatting of real and complex numbers, controlled by settings like [`setQuESTMaxNumReportedSigFigs()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga15d46e5d813f70b587762814964e1994). But we can also report every data structure in the QuEST API, such as Pauli strings ```cpp reportPauliStr( getInlinePauliStr("XXYYZZ", {5,50, 10,60, 30,40}) @@ -806,7 +806,7 @@ PauliStrSum (4 terms, 160 bytes): All outputs are affected by the [reporter settings](https://quest-kit.github.io/QuEST/group__debug__reporting.html). ```cpp setQuESTMaxNumReportedItems(4,4); -setMaxNumReportedSigFigs(1); +setQuESTMaxNumReportedSigFigs(1); reportCompMatr(bigmatrix); ``` ``` diff --git a/examples/extended/dynamics.c b/examples/extended/dynamics.c index b26a1ba36..a8183ce48 100644 --- a/examples/extended/dynamics.c +++ b/examples/extended/dynamics.c @@ -103,7 +103,7 @@ PauliStrSum createMyObservable(int numQubits) { void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { - setMaxNumReportedSigFigs(6); // sig-figs in scalars + setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars setNumReportedNewlines(2); // spacing between reports setReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) @@ -144,7 +144,7 @@ int main() { reportMyStructs(qureg, hamil, observ); // tidy reporting of below expectation values - setMaxNumReportedSigFigs(3); + setQuESTMaxNumReportedSigFigs(3); setNumReportedNewlines(1); // evolve by repeatedly (each is a "step") Trotterising diff --git a/examples/extended/dynamics.cpp b/examples/extended/dynamics.cpp index 3e0af1fca..f600c69d7 100644 --- a/examples/extended/dynamics.cpp +++ b/examples/extended/dynamics.cpp @@ -100,7 +100,7 @@ PauliStrSum createMyObservable(int numQubits) { void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { - setMaxNumReportedSigFigs(6); // sig-figs in scalars + setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars setNumReportedNewlines(2); // spacing between reports setReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) @@ -141,7 +141,7 @@ int main() { reportMyStructs(qureg, hamil, observ); // tidy reporting of below expectation values - setMaxNumReportedSigFigs(3); + setQuESTMaxNumReportedSigFigs(3); setNumReportedNewlines(1); // evolve by repeatedly (each is a "step") Trotterising diff --git a/quest/include/debug.h b/quest/include/debug.h index 9f1e141fd..da29c63d0 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -123,7 +123,7 @@ void setQuESTMaxNumReportedItems(qindex numRows, qindex numCols); * > (e.g. `5.32 KiB`) which is always shown with three significant figures * > (or four when in bytes, e.g. `1023 bytes`). */ -void setMaxNumReportedSigFigs(int numSigFigs); +void setQuESTMaxNumReportedSigFigs(int numSigFigs); /// @notyetdoced diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 748e13089..34a6a3f9f 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -139,7 +139,7 @@ void setQuESTMaxNumReportedItems(qindex numRows, qindex numCols) { } -void setMaxNumReportedSigFigs(int numSigFigs) { +void setQuESTMaxNumReportedSigFigs(int numSigFigs) { validate_envIsInit(__func__); validate_newMaxNumReportedSigFigs(numSigFigs, __func__); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 28b583e39..0f90ed7d2 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -62,7 +62,7 @@ TEST_CASE( "setQuESTInputErrorHandler", TEST_CATEGORY ) { } -TEST_CASE( "setMaxNumReportedSigFigs", TEST_CATEGORY ) { +TEST_CASE( "setQuESTMaxNumReportedSigFigs", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { @@ -81,7 +81,7 @@ TEST_CASE( "setMaxNumReportedSigFigs", TEST_CATEGORY ) { for (size_t numSigFigs=1; numSigFigs<=refs.size(); numSigFigs++) { - setMaxNumReportedSigFigs(numSigFigs); + setQuESTMaxNumReportedSigFigs(numSigFigs); // redirect stdout to buffer std::stringstream buffer; @@ -103,12 +103,12 @@ TEST_CASE( "setMaxNumReportedSigFigs", TEST_CATEGORY ) { int num = GENERATE( -1, 0 ); - REQUIRE_THROWS_WITH( setMaxNumReportedSigFigs(num), ContainsSubstring("Cannot be less than one") ); + REQUIRE_THROWS_WITH( setQuESTMaxNumReportedSigFigs(num), ContainsSubstring("Cannot be less than one") ); } } // restore to QuEST default for future tests - setMaxNumReportedSigFigs(5); + setQuESTMaxNumReportedSigFigs(5); } From b83f6f9979c10a4bd9ef6cc598c454bbccf8ae75 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:46:47 -0400 Subject: [PATCH 11/17] rename setNumReportedNewlines beware that hyperlinked doc files must be updated, since the URL depends on the function signature hash --- docs/tutorial.md | 4 ++-- examples/extended/dynamics.c | 6 +++--- examples/extended/dynamics.cpp | 6 +++--- quest/include/debug.h | 2 +- quest/src/api/debug.cpp | 2 +- quest/src/core/validation.cpp | 4 ++-- tests/unit/debug.cpp | 12 ++++++------ 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index c61d5013f..ddd13ac48 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -188,7 +188,7 @@ setQuESTMaxNumReportedSigFigs(3); ``` or [add](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga29413703d609254244d6b13c663e6e06) extra spacing between QuEST's printed outputs ```cpp -setNumReportedNewlines(3); +setQuESTNumReportedNewlines(3); ``` Perhaps we also wish to relax the [precision](https://quest-kit.github.io/QuEST/group__debug__validation.html#gae395568df6def76045ec1881fcb4e6d1) with which our future inputs will be asserted unitary or Hermitian @@ -356,7 +356,7 @@ Qureg: globalTotal.......16 MiB ``` -> The spacing between the outputs of those two consecutive QuEST functions was determined by our earlier call to [`setNumReportedNewlines()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga29413703d609254244d6b13c663e6e06). +> The spacing between the outputs of those two consecutive QuEST functions was determined by our earlier call to [`setQuESTNumReportedNewlines()`](https://quest-kit.github.io/QuEST/group__debug__reporting.html#ga29413703d609254244d6b13c663e6e06). A density matrix `Qureg` can model classical uncertainty as results from [decoherence](https://quest-kit.github.io/QuEST/group__decoherence.html), and proves useful when simulating quantum operations on a noisy quantum computer. diff --git a/examples/extended/dynamics.c b/examples/extended/dynamics.c index a8183ce48..ef2e99534 100644 --- a/examples/extended/dynamics.c +++ b/examples/extended/dynamics.c @@ -104,7 +104,7 @@ PauliStrSum createMyObservable(int numQubits) { void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars - setNumReportedNewlines(2); // spacing between reports + setQuESTNumReportedNewlines(2); // spacing between reports setReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes @@ -145,7 +145,7 @@ int main() { // tidy reporting of below expectation values setQuESTMaxNumReportedSigFigs(3); - setNumReportedNewlines(1); + setQuESTNumReportedNewlines(1); // evolve by repeatedly (each is a "step") Trotterising // exp(-i dt H) with the specified order and repetitions. @@ -172,7 +172,7 @@ int main() { reportStr(""); // preview the final state... - setNumReportedNewlines(2); + setQuESTNumReportedNewlines(2); setQuESTMaxNumReportedItems(25, 25); reportStr("[Final state]"); reportQureg(qureg); diff --git a/examples/extended/dynamics.cpp b/examples/extended/dynamics.cpp index f600c69d7..294af1e05 100644 --- a/examples/extended/dynamics.cpp +++ b/examples/extended/dynamics.cpp @@ -101,7 +101,7 @@ PauliStrSum createMyObservable(int numQubits) { void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars - setNumReportedNewlines(2); // spacing between reports + setQuESTNumReportedNewlines(2); // spacing between reports setReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes @@ -142,7 +142,7 @@ int main() { // tidy reporting of below expectation values setQuESTMaxNumReportedSigFigs(3); - setNumReportedNewlines(1); + setQuESTNumReportedNewlines(1); // evolve by repeatedly (each is a "step") Trotterising // exp(-i dt H) with the specified order and repetitions. @@ -166,7 +166,7 @@ int main() { reportStr(""); // preview the final state... - setNumReportedNewlines(2); + setQuESTNumReportedNewlines(2); setQuESTMaxNumReportedItems(25, 25); reportStr("[Final state]"); reportQureg(qureg); diff --git a/quest/include/debug.h b/quest/include/debug.h index da29c63d0..20da45f18 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -127,7 +127,7 @@ void setQuESTMaxNumReportedSigFigs(int numSigFigs); /// @notyetdoced -void setNumReportedNewlines(int numNewlines); +void setQuESTNumReportedNewlines(int numNewlines); /** diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 34a6a3f9f..3f845b1dc 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -147,7 +147,7 @@ void setQuESTMaxNumReportedSigFigs(int numSigFigs) { } -void setNumReportedNewlines(int numNewlines) { +void setQuESTNumReportedNewlines(int numNewlines) { validate_envIsInit(__func__); validate_newNumReportedNewlines(numNewlines, __func__); diff --git a/quest/src/core/validation.cpp b/quest/src/core/validation.cpp index 3b6fc18a2..2db517548 100644 --- a/quest/src/core/validation.cpp +++ b/quest/src/core/validation.cpp @@ -136,7 +136,7 @@ namespace report { "Invalid number of trailing newlines (${NUM_NEWLINES}). Cannot generally be less than zero, and must not be zero when calling multi-line reporting functions like reportQureg()."; string INSUFFICIENT_NUM_REPORTED_NEWLINES = - "The number of trailing newlines (set by setNumReportedNewlines()) is zero which is not permitted when calling multi-line reporters."; + "The number of trailing newlines (set by setQuESTNumReportedNewlines()) is zero which is not permitted when calling multi-line reporters."; string INVALID_NUM_NEW_PAULI_CHARS = "Given an invalid number of Pauli characters. Must specify precisely four to respectively replace IXYZ."; @@ -1144,7 +1144,7 @@ void default_inputErrorHandler(const char* func, const char* msg) { // safe to call even before MPI has been setup, and ignores user-set trailing newlines. // It begins with \n to interrupt half-printed lines (when trailing newlines are set to - // 0 via setNumReportedNewlines(0)), for visual clarity. Note that user's overriding + // 0 via setQuESTNumReportedNewlines(0)), for visual clarity. Note that user's overriding // functions might not think to print an initial newline but oh well! print(string("\n") + "QuEST encountered a validation error during function " diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 0f90ed7d2..64b6b1ddc 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -77,7 +77,7 @@ TEST_CASE( "setQuESTMaxNumReportedSigFigs", TEST_CATEGORY ) { }; // disable auto \n after lines - setNumReportedNewlines(0); + setQuESTNumReportedNewlines(0); for (size_t numSigFigs=1; numSigFigs<=refs.size(); numSigFigs++) { @@ -112,13 +112,13 @@ TEST_CASE( "setQuESTMaxNumReportedSigFigs", TEST_CATEGORY ) { } -TEST_CASE( "setNumReportedNewlines", TEST_CATEGORY ) { +TEST_CASE( "setQuESTNumReportedNewlines", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { for (int numNewlines=0; numNewlines<3; numNewlines++) { - setNumReportedNewlines(numNewlines); + setQuESTNumReportedNewlines(numNewlines); // redirect stdout to buffer std::stringstream buffer; @@ -138,19 +138,19 @@ TEST_CASE( "setNumReportedNewlines", TEST_CATEGORY ) { SECTION( "number" ) { - REQUIRE_THROWS_WITH( setNumReportedNewlines(-1), ContainsSubstring("Cannot generally be less than zero") ); + REQUIRE_THROWS_WITH( setQuESTNumReportedNewlines(-1), ContainsSubstring("Cannot generally be less than zero") ); } SECTION( "multine number" ) { - setNumReportedNewlines(0); + setQuESTNumReportedNewlines(0); REQUIRE_THROWS_WITH( reportQuESTEnv(), ContainsSubstring("zero") && ContainsSubstring("not permitted when calling multi-line") ); } } // restore to QuEST default for future tests - setNumReportedNewlines(2); + setQuESTNumReportedNewlines(2); } From df332b128e1b8728fd93ab0c7e04cda9fcce04d6 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:47:24 -0400 Subject: [PATCH 12/17] rename setReportedPauliChars --- examples/extended/dynamics.c | 2 +- examples/extended/dynamics.cpp | 2 +- quest/include/debug.h | 4 ++-- quest/src/api/debug.cpp | 2 +- tests/unit/debug.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/extended/dynamics.c b/examples/extended/dynamics.c index ef2e99534..d332f556e 100644 --- a/examples/extended/dynamics.c +++ b/examples/extended/dynamics.c @@ -105,7 +105,7 @@ void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars setQuESTNumReportedNewlines(2); // spacing between reports - setReportedPauliChars(".XYZ"); // print I as . + setQuESTReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes diff --git a/examples/extended/dynamics.cpp b/examples/extended/dynamics.cpp index 294af1e05..b42ef0384 100644 --- a/examples/extended/dynamics.cpp +++ b/examples/extended/dynamics.cpp @@ -102,7 +102,7 @@ void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars setQuESTNumReportedNewlines(2); // spacing between reports - setReportedPauliChars(".XYZ"); // print I as . + setQuESTReportedPauliChars(".XYZ"); // print I as . setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes diff --git a/quest/include/debug.h b/quest/include/debug.h index 20da45f18..a7f190f16 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -138,11 +138,11 @@ void setQuESTNumReportedNewlines(int numNewlines); PauliStr str = getInlinePauliStr("XYZ", {0,10,20}); reportPauliStr(str); - setReportedPauliChars(".xyz"); + setQuESTReportedPauliChars(".xyz"); reportPauliStr(str); * ``` */ -void setReportedPauliChars(const char* paulis); +void setQuESTReportedPauliChars(const char* paulis); /** diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 3f845b1dc..7ea976d14 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -155,7 +155,7 @@ void setQuESTNumReportedNewlines(int numNewlines) { } -void setReportedPauliChars(const char* paulis) { +void setQuESTReportedPauliChars(const char* paulis) { validate_envIsInit(__func__); validate_numPauliChars(paulis, __func__); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 64b6b1ddc..355462804 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -750,6 +750,6 @@ void setQuESTMaxNumReportedItems(qindex numRows, qindex numCols); void getEnvironmentString(char str[200]); -void setReportedPauliChars(const char* paulis); +void setQuESTReportedPauliChars(const char* paulis); void setReportedPauliStrStyle(int style); From 1293b51dcfa30d4c185e22584bf9aa35a1f55ded Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:47:41 -0400 Subject: [PATCH 13/17] rename setReportedPauliStrStyle --- examples/extended/dynamics.c | 2 +- examples/extended/dynamics.cpp | 2 +- quest/include/debug.h | 6 +++--- quest/src/api/debug.cpp | 2 +- tests/unit/debug.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/extended/dynamics.c b/examples/extended/dynamics.c index d332f556e..8c72d71ab 100644 --- a/examples/extended/dynamics.c +++ b/examples/extended/dynamics.c @@ -106,7 +106,7 @@ void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars setQuESTNumReportedNewlines(2); // spacing between reports setQuESTReportedPauliChars(".XYZ"); // print I as . - setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) + setQuESTReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes reportStr("[Initial state]"); diff --git a/examples/extended/dynamics.cpp b/examples/extended/dynamics.cpp index b42ef0384..da4fd9223 100644 --- a/examples/extended/dynamics.cpp +++ b/examples/extended/dynamics.cpp @@ -103,7 +103,7 @@ void reportMyStructs(Qureg qureg, PauliStrSum hamil, PauliStrSum observ) { setQuESTMaxNumReportedSigFigs(6); // sig-figs in scalars setQuESTNumReportedNewlines(2); // spacing between reports setQuESTReportedPauliChars(".XYZ"); // print I as . - setReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) + setQuESTReportedPauliStrStyle(0); // print XYZ (0) or Z3 Y2 X1 (1) setQuESTMaxNumReportedItems(8, 8); // show max 8 qureg amplitudes reportStr("[Initial state]"); diff --git a/quest/include/debug.h b/quest/include/debug.h index a7f190f16..2fa26bc4a 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -152,14 +152,14 @@ void setQuESTReportedPauliChars(const char* paulis); * ``` PauliStr str = getInlinePauliStr("XYZ", {0,10,20}); - setReportedPauliStrStyle(0); + setQuESTReportedPauliStrStyle(0); reportPauliStr(str); - setReportedPauliStrStyle(1); + setQuESTReportedPauliStrStyle(1); reportPauliStr(str); * ``` */ -void setReportedPauliStrStyle(int style); +void setQuESTReportedPauliStrStyle(int style); /** @} */ diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 7ea976d14..505029ba4 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -163,7 +163,7 @@ void setQuESTReportedPauliChars(const char* paulis) { } -void setReportedPauliStrStyle(int flag) { +void setQuESTReportedPauliStrStyle(int flag) { validate_envIsInit(__func__); validate_reportedPauliStrStyleFlag(flag, __func__); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 355462804..1ec379b88 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -752,4 +752,4 @@ void getEnvironmentString(char str[200]); void setQuESTReportedPauliChars(const char* paulis); -void setReportedPauliStrStyle(int style); +void setQuESTReportedPauliStrStyle(int style); From 52df8ac016c7866e102a1fa746b9ad9dff95abad Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:47:59 -0400 Subject: [PATCH 14/17] rename getGpuCacheSize --- quest/include/debug.h | 2 +- quest/src/api/debug.cpp | 2 +- tests/unit/debug.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/quest/include/debug.h b/quest/include/debug.h index 2fa26bc4a..240a4ea96 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -174,7 +174,7 @@ void setQuESTReportedPauliStrStyle(int style); /// @notyetdoced -qindex getGpuCacheSize(); +qindex getQuESTGpuCacheSize(); /// @notyetdoced diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index 505029ba4..e4974d4a5 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -177,7 +177,7 @@ void setQuESTReportedPauliStrStyle(int flag) { */ -qindex getGpuCacheSize() { +qindex getQuESTGpuCacheSize() { validate_envIsInit(__func__); if (getQuESTEnv().isGpuAccelerated) diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index 1ec379b88..ef6409bfd 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -678,13 +678,13 @@ TEST_CASE( "setQuESTValidationEpsilonToDefault", TEST_CATEGORY ) { } -TEST_CASE( "getGpuCacheSize", TEST_CATEGORY ) { +TEST_CASE( "getQuESTGpuCacheSize", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { // confirm cache begins empty clearGpuCache(); - REQUIRE( getGpuCacheSize() == 0 ); + REQUIRE( getQuESTGpuCacheSize() == 0 ); // hackily detect cuQuantum char envStr[200]; @@ -716,7 +716,7 @@ TEST_CASE( "getGpuCacheSize", TEST_CATEGORY ) { // confirm it expanded, OR stayed the same, which happens when // the total number of simultaneous threads needed hits/exceeds // the number available in the hardware - qindex newSize = getGpuCacheSize(); + qindex newSize = getQuESTGpuCacheSize(); CAPTURE( cacheSize, newSize ); REQUIRE( newSize >= cacheSize ); From 81013d4beffe28a8f220a2539010cef00227d643 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:48:20 -0400 Subject: [PATCH 15/17] rename clearGpuCache --- quest/include/debug.h | 2 +- quest/src/api/debug.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quest/include/debug.h b/quest/include/debug.h index 240a4ea96..820867c01 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -178,7 +178,7 @@ qindex getQuESTGpuCacheSize(); /// @notyetdoced -void clearGpuCache(); +void clearQuESTGpuCache(); /** @} */ diff --git a/quest/src/api/debug.cpp b/quest/src/api/debug.cpp index e4974d4a5..e6c6b9f2a 100644 --- a/quest/src/api/debug.cpp +++ b/quest/src/api/debug.cpp @@ -188,7 +188,7 @@ qindex getQuESTGpuCacheSize() { } -void clearGpuCache() { +void clearQuESTGpuCache() { validate_envIsInit(__func__); // safely do nothing if not GPU accelerated From 310005882e592bd4df7747fbc1a6562ca3512e16 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 22:49:13 -0400 Subject: [PATCH 16/17] rename getEnvironmentString --- quest/include/debug.h | 2 +- quest/include/deprecated.h | 6 +++--- quest/src/api/environment.cpp | 2 +- tests/unit/debug.cpp | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/quest/include/debug.h b/quest/include/debug.h index 820867c01..a51236141 100644 --- a/quest/include/debug.h +++ b/quest/include/debug.h @@ -194,7 +194,7 @@ void clearQuESTGpuCache(); /// @notyetdoced /// @notyettested -void getEnvironmentString(char str[200]); +void getQuESTEnvironmentString(char str[200]); /** @} */ diff --git a/quest/include/deprecated.h b/quest/include/deprecated.h index f505a5874..ba9eadc05 100644 --- a/quest/include/deprecated.h +++ b/quest/include/deprecated.h @@ -548,13 +548,13 @@ typedef enum pauliOpType _NoWarnPauliOpType; #define _GET_ENVIRONMENT_STRING_1(str) \ - getEnvironmentString(str) + getQuESTEnvironmentString(str) #define _GET_ENVIRONMENT_STRING_2(str) \ - _WARN_FUNC_NOW_HAS_FEWER_ARGS("getEnvironmentString(QuESTEnv, char[200])", "getEnvironmentString(char[200])") \ + _WARN_FUNC_NOW_HAS_FEWER_ARGS("getQuESTEnvironmentString(QuESTEnv, char[200])", "getQuESTEnvironmentString(char[200])") \ _GET_ENVIRONMENT_STRING_1(str) -#define getEnvironmentString(...) \ +#define getQuESTEnvironmentString(...) \ _CALL_MACRO_WITH_1_OR_2_ARGS(_GET_ENVIRONMENT_STRING, __VA_ARGS__) diff --git a/quest/src/api/environment.cpp b/quest/src/api/environment.cpp index 541491899..6f4a45a32 100644 --- a/quest/src/api/environment.cpp +++ b/quest/src/api/environment.cpp @@ -489,7 +489,7 @@ void reportQuESTEnv() { } -void getEnvironmentString(char str[200]) { +void getQuESTEnvironmentString(char str[200]) { validate_envIsInit(__func__); QuESTEnv env = getQuESTEnv(); diff --git a/tests/unit/debug.cpp b/tests/unit/debug.cpp index ef6409bfd..714cffe7b 100644 --- a/tests/unit/debug.cpp +++ b/tests/unit/debug.cpp @@ -683,12 +683,12 @@ TEST_CASE( "getQuESTGpuCacheSize", TEST_CATEGORY ) { SECTION( LABEL_CORRECTNESS ) { // confirm cache begins empty - clearGpuCache(); + clearQuESTGpuCache(); REQUIRE( getQuESTGpuCacheSize() == 0 ); // hackily detect cuQuantum char envStr[200]; - getEnvironmentString(envStr); + getQuESTEnvironmentString(envStr); bool usingCuQuantum = std::string(envStr).find("cuQuantum=0") == std::string::npos; // proceed only if we're ever using our own GPU cache @@ -748,7 +748,7 @@ TEST_CASE( "getQuESTGpuCacheSize", TEST_CATEGORY ) { void setQuESTMaxNumReportedItems(qindex numRows, qindex numCols); -void getEnvironmentString(char str[200]); +void getQuESTEnvironmentString(char str[200]); void setQuESTReportedPauliChars(const char* paulis); From ffc36323e05a95c078d3ccdc82b230dbd7e48c04 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Mon, 18 May 2026 23:16:30 -0400 Subject: [PATCH 17/17] patch deprecated getQuESTSeeds handling --- quest/include/deprecated.h | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/quest/include/deprecated.h b/quest/include/deprecated.h index ba9eadc05..f70b2102c 100644 --- a/quest/include/deprecated.h +++ b/quest/include/deprecated.h @@ -449,13 +449,6 @@ typedef enum pauliOpType _NoWarnPauliOpType; "setDensityQuregAmps(Qureg, qindex startRow, qindex startCol, qcomp** amps, qindex numRows, qindex numCols)") -#define getQuESTSeeds(...) \ - _ERROR_GENERAL_MSG( \ - "The QuEST function 'getQuESTSeeds(QuESTEnv env, unsigned long int* out, int numOut)' has been deprecated. " \ - "Please instead use 'getQuESTSeeds(unsigned* out)' which accepts a pointer to pre-allocated memory of length " \ - "equal to that returned by 'getQuESTNumSeeds()'. We cannot automatically invoke this replacement routine." ) - - #define applyPhaseFunc(...) \ _ERROR_PHASE_FUNC_REMOVED("applyPhaseFunc") @@ -559,6 +552,33 @@ typedef enum pauliOpType _NoWarnPauliOpType; +/* + * FUNCTIONS WITH THE SAME NAME BUT 1 INSTEAD OF 3 ARGS + * + * which are handled similar to above + */ + + +#define _GET_MACRO_WITH_1_OR_3_ARGS(_1, _2, _3, macroname, ...) macroname + +#define _CALL_MACRO_WITH_1_OR_3_ARGS(prefix, ...) \ + _GET_MACRO_WITH_1_OR_3_ARGS(__VA_ARGS__, prefix##_3, prefix##_2, prefix##_1)(__VA_ARGS__) + + +#define _GET_QUEST_SEEDS_1(out) \ + getQuESTSeeds(out) + +#define _GET_QUEST_SEEDS_3(env, out, numOut) \ + _WARN_FUNC_NOW_HAS_FEWER_ARGS( \ + "getQuESTSeeds(QuESTEnv env, unsigned long int* out, int numOut)", \ + "getQuESTSeeds(unsigned* out)") \ + _GET_QUEST_SEEDS_1(out) + +#define getQuESTSeeds(...) \ + _CALL_MACRO_WITH_1_OR_3_ARGS(_GET_QUEST_SEEDS, __VA_ARGS__) + + + /* * FUNCTIONS WITH THE SAME NAME BUT 0 INSTEAD OF 1 ARGS *