test_operators.cpp File Reference
#include "catch.hpp"
#include "QuEST.h"
#include "utilities.hpp"

Go to the source code of this file.

Macros

#define CLEANUP_TEST(quregVec, quregMatr)
 Destroys the data structures made by PREPARE_TEST. More...
 
#define PREPARE_TEST(quregVec, quregMatr, refVec, refMatr)
 Prepares the needed data structures for unit testing some operators. More...
 

Functions

 TEST_CASE ("applyDiagonalOp", "[operators]")
 
 TEST_CASE ("applyFullQFT", "[operators]")
 
 TEST_CASE ("applyMatrix2", "[operators]")
 
 TEST_CASE ("applyMatrix4", "[operators]")
 
 TEST_CASE ("applyMatrixN", "[operators]")
 
 TEST_CASE ("applyMultiControlledMatrixN", "[operators]")
 
 TEST_CASE ("applyMultiVarPhaseFunc", "[operators]")
 
 TEST_CASE ("applyMultiVarPhaseFuncOverrides", "[operators]")
 
 TEST_CASE ("applyNamedPhaseFunc", "[operators]")
 
 TEST_CASE ("applyNamedPhaseFuncOverrides", "[operators]")
 
 TEST_CASE ("applyParamNamedPhaseFunc", "[operators]")
 
 TEST_CASE ("applyParamNamedPhaseFuncOverrides", "[operators]")
 
 TEST_CASE ("applyPauliHamil", "[operators]")
 
 TEST_CASE ("applyPauliSum", "[operators]")
 
 TEST_CASE ("applyPhaseFunc", "[operators]")
 
 TEST_CASE ("applyPhaseFuncOverrides", "[operators]")
 
 TEST_CASE ("applyProjector", "[operators]")
 
 TEST_CASE ("applyQFT", "[operators]")
 
 TEST_CASE ("applyTrotterCircuit", "[operators]")
 

Macro Definition Documentation

◆ CLEANUP_TEST

#define CLEANUP_TEST (   quregVec,
  quregMatr 
)
Value:
destroyQureg(quregVec, QUEST_ENV); \
destroyQureg(quregMatr, QUEST_ENV);

Destroys the data structures made by PREPARE_TEST.

Definition at line 19 of file test_operators.cpp.

◆ PREPARE_TEST

#define PREPARE_TEST (   quregVec,
  quregMatr,
  refVec,
  refMatr 
)
Value:
Qureg quregMatr = createDensityQureg(NUM_QUBITS, QUEST_ENV); \
initDebugState(quregVec); \
initDebugState(quregMatr); \
QVector refVec = toQVector(quregVec); \
QMatrix refMatr = toQMatrix(quregMatr);

Prepares the needed data structures for unit testing some operators.

This creates a statevector and density matrix of the size NUM_QUBITS, and corresponding QVector and QMatrix instances for analytic comparison.

Definition at line 10 of file test_operators.cpp.

QuESTEnv QUEST_ENV
The global QuESTEnv instance, to be created and destroyed once in this main(), so that the MPI enviro...
Definition: main.cpp:20
#define NUM_QUBITS
The default number of qubits in the registers created for unit testing (both statevectors and density...
Definition: utilities.hpp:36
QMatrix toQMatrix(ComplexMatrix2 src)
Returns a copy of the given 2-by-2 matrix.
Definition: utilities.cpp:1044
QVector toQVector(Qureg qureg)
Returns an equal-size copy of the given state-vector qureg.
Definition: utilities.cpp:1113
void destroyQureg(Qureg qureg, QuESTEnv env)
Deallocate a Qureg, freeing its memory.
Definition: QuEST.c:77
Represents a system of qubits.
Definition: QuEST.h:322
Qureg createQureg(int numQubits, QuESTEnv env)
Creates a state-vector Qureg object representing a set of qubits which will remain in a pure state.
Definition: QuEST.c:36
Qureg createDensityQureg(int numQubits, QuESTEnv env)
Creates a density matrix Qureg object representing a set of qubits which can enter noisy and mixed st...
Definition: QuEST.c:50