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

Testing utilities for loading environment variables which configure the unit tests, independent of QuEST's internal environment variable facilities. More...

Functions

int getMaxNumTestedQubitPermutations ()
 
int getMaxNumTestedSuperoperatorTargets ()
 
int getNumQubitsInUnitTestedQuregs ()
 
int getNumTestedMixedDeploymentRepetitions ()
 
bool getWhetherToTestAllDeployments ()
 

Variables

const int TEST_ALL_DEPLOYMENTS = 1
 
const int TEST_MAX_NUM_QUBIT_PERMUTATIONS = 0
 
const int TEST_MAX_NUM_SUPEROP_TARGETS = 4
 
const int TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS = 10
 
const int TEST_NUM_QUBITS_IN_QUREG = 6
 

Detailed Description

Testing utilities for loading environment variables which configure the unit tests, independent of QuEST's internal environment variable facilities.

Function Documentation

◆ getMaxNumTestedQubitPermutations()

int getMaxNumTestedQubitPermutations ( )

Definition at line 54 of file config.cpp.

54 {
55
56 static int value = getIntEnvVarValueOrDefault("TEST_MAX_NUM_QUBIT_PERMUTATIONS", 0);
57 return value;
58}

◆ getMaxNumTestedSuperoperatorTargets()

int getMaxNumTestedSuperoperatorTargets ( )

Definition at line 60 of file config.cpp.

60 {
61
62 static int value = getIntEnvVarValueOrDefault("TEST_MAX_NUM_SUPEROP_TARGETS", 4);
63 return value;
64}

◆ getNumQubitsInUnitTestedQuregs()

int getNumQubitsInUnitTestedQuregs ( )

Definition at line 48 of file config.cpp.

48 {
49
50 static int value = getIntEnvVarValueOrDefault("TEST_NUM_QUBITS_IN_QUREG", 6);
51 return value;
52}

◆ getNumTestedMixedDeploymentRepetitions()

int getNumTestedMixedDeploymentRepetitions ( )

Definition at line 66 of file config.cpp.

66 {
67
68 static int value = getIntEnvVarValueOrDefault("TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS", 10);
69 return value;
70}

◆ getWhetherToTestAllDeployments()

bool getWhetherToTestAllDeployments ( )

Definition at line 72 of file config.cpp.

72 {
73
74 static bool value = getIntEnvVarValueOrDefault("TEST_ALL_DEPLOYMENTS", 1);
75 return value;
76}

Variable Documentation

◆ TEST_ALL_DEPLOYMENTS

const int TEST_ALL_DEPLOYMENTS = 1
Note
This entity is actually an environment variable.

Definition at line 73 of file config.hpp.

◆ TEST_MAX_NUM_QUBIT_PERMUTATIONS

const int TEST_MAX_NUM_QUBIT_PERMUTATIONS = 0
Note
This entity is actually an environment variable.

Specifies the maximum number of control and target qubit permutations for which to unit test each relevant API function.

Many QuEST functions accept a varying number of target qubits (like applyCompMatr()) and/or control qubits (like applyMultiControlledCompMatr()). The unit tests will run these functions, passing every possible number of target qubits (alongside every possible number of control qubits, if possible), from one (zero) up to the number contained within the tested Qureg (minus the number of target qubits).

For each of these tested number-of-targets and number-of-controls combinations, there are factorially-many possible choices of the arbitrarily-ordered qubit indices, i.e. sub-permutations of all Qureg qubits. By default, the unit tests deterministically check every permutation in-turn. This can become prohibitively slow when the tested Qureg are large. For example, there are 604,800 unique, non-overlapping choices of 4 targets and 3 controls in a Qureg containing 10 qubits.

When this environment variable is set to a non-zero value, the unit tests will forego testing every permutation and instead perform only the number specified, randomising the involved qubits. This can significantly speed up the tests though risks missing esoteric edge-cases. The runtime of the tests are approximately linearly proportional to the specified number of permutations. When the specified non-zero value exceeds the number of unique permutations, the tests will revert to deterministically evaluating each once.

Values
  • set to 0 (default) to systematically test all permutations.
  • set to a positive integer (e.g. 50) to test (at most) that many random permutations and accelerate the tests.
Author
Tyson Jones

Definition at line 67 of file config.hpp.

◆ TEST_MAX_NUM_SUPEROP_TARGETS

const int TEST_MAX_NUM_SUPEROP_TARGETS = 4
Note
This entity is actually an environment variable.

Definition at line 70 of file config.hpp.

◆ TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS

const int TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS = 10
Note
This entity is actually an environment variable.

Definition at line 76 of file config.hpp.

◆ TEST_NUM_QUBITS_IN_QUREG

const int TEST_NUM_QUBITS_IN_QUREG = 6
Note
This entity is actually an environment variable.

Definition at line 36 of file config.hpp.