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 ("applyMatrix2", "[operators]")
 
 TEST_CASE ("applyMatrix4", "[operators]")
 
 TEST_CASE ("applyMatrixN", "[operators]")
 
 TEST_CASE ("applyMultiControlledMatrixN", "[operators]")
 
 TEST_CASE ("applyPauliHamil", "[operators]")
 
 TEST_CASE ("applyPauliSum", "[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:869
QVector toQVector(Qureg qureg)
Returns an equal-size copy of the given state-vector qureg.
Definition: utilities.cpp:938
void destroyQureg(Qureg qureg, QuESTEnv env)
Deallocate a Qureg object representing a set of qubits.
Definition: QuEST.c:77
Represents a system of qubits.
Definition: QuEST.h:203
Qureg createQureg(int numQubits, QuESTEnv env)
Create a Qureg object representing a set of qubits which will remain in a pure state.
Definition: QuEST.c:36
Qureg createDensityQureg(int numQubits, QuESTEnv env)
Create a Qureg for qubits which are represented by a density matrix, and can be in mixed states.
Definition: QuEST.c:50