Precision-agnostic types and data structures for representing numbers, quantum states, and operators. More...
Data Structures | |
struct | Complex |
Represents one complex number. More... | |
struct | ComplexMatrix2 |
Represents a 2x2 matrix of complex numbers. More... | |
struct | ComplexMatrix4 |
Represents a 4x4 matrix of complex numbers. More... | |
struct | ComplexMatrixN |
Represents a general 2^N by 2^N matrix of complex numbers. More... | |
struct | DiagonalOp |
Represents a diagonal complex operator on the full Hilbert state of a Qureg . More... | |
struct | PauliHamil |
Represents a weighted sum of pauli products. More... | |
struct | QuESTEnv |
Information about the environment the program is running in. More... | |
struct | Qureg |
Represents a system of qubits. More... | |
struct | Vector |
Represents a 3-vector of real numbers. More... | |
Macros | |
#define | fromComplex(comp) qcomp(comp.real, comp.imag) |
#define | getStaticComplexMatrixN(numQubits, re, im) |
Creates a ComplexMatrixN struct which lives in the stack and so does not need freeing, but cannot be returned beyond the calling scope. More... | |
#define | qcomp |
#define | qreal double |
#define | QuEST_PREC 2 |
#define | toComplex(scalar) ((Complex) {.real = creal(scalar), .imag = cimag(scalar)}) |
Enumerations | |
enum | pauliOpType { PAULI_I =0, PAULI_X =1, PAULI_Y =2, PAULI_Z =3 } |
Codes for specifying Pauli operators. More... | |
Functions | |
Qureg | createCloneQureg (Qureg qureg, QuESTEnv env) |
Create a new Qureg which is an exact clone of the passed qureg, which can be either a statevector or a density matrix. More... | |
ComplexMatrixN | createComplexMatrixN (int numQubits) |
Create (dynamically) a square complex matrix which can be passed to the multi-qubit general unitary functions. More... | |
Qureg | createDensityQureg (int numQubits, QuESTEnv env) |
Create a Qureg for qubits which are represented by a density matrix, and can be in mixed states. More... | |
DiagonalOp | createDiagonalOp (int numQubits, QuESTEnv env) |
Creates a DiagonalOp representing a diagonal operator on the full Hilbert space of a Qureg. More... | |
PauliHamil | createPauliHamil (int numQubits, int numSumTerms) |
Create a PauliHamil instance, which is a Hamiltonian expressed as a real-weighted sum of products of Pauli operators. More... | |
PauliHamil | createPauliHamilFromFile (char *fn) |
Create a PauliHamil instance, a real-weighted sum of products of Pauli operators, populated with the data in filename fn . More... | |
QuESTEnv | createQuESTEnv (void) |
Create the QuEST execution environment. More... | |
Qureg | createQureg (int numQubits, QuESTEnv env) |
Create a Qureg object representing a set of qubits which will remain in a pure state. More... | |
void | destroyComplexMatrixN (ComplexMatrixN matr) |
Destroy a ComplexMatrixN instance created with createComplexMatrixN() More... | |
void | destroyDiagonalOp (DiagonalOp op, QuESTEnv env) |
Destroys a DiagonalOp created with createDiagonalOp(), freeing its memory. More... | |
void | destroyPauliHamil (PauliHamil hamil) |
Destroy a PauliHamil instance, created with either createPauliHamil() or createPauliHamilFromFile(). More... | |
void | destroyQuESTEnv (QuESTEnv env) |
Destroy the QuEST environment. More... | |
void | destroyQureg (Qureg qureg, QuESTEnv env) |
Deallocate a Qureg object representing a set of qubits. More... | |
void | initComplexMatrixN (ComplexMatrixN m, qreal real[][1<< m.numQubits], qreal imag[][1<< m.numQubits]) |
Initialises a ComplexMatrixN instance to have the passed real and imag values. More... | |
void | initDiagonalOp (DiagonalOp op, qreal *real, qreal *imag) |
Updates the entire DiagonalOp op with the given elements, of which there must be 2^op.numQubits . More... | |
void | initPauliHamil (PauliHamil hamil, qreal *coeffs, enum pauliOpType *codes) |
Initialise a PauliHamil instance with the given term coefficients and Pauli codes (one for every qubit in every term). More... | |
void | setDiagonalOpElems (DiagonalOp op, long long int startInd, qreal *real, qreal *imag, long long int numElems) |
Modifies a subset (starting at index startInd ) of the elements in DiagonalOp op with the given elements, of which there are numElems . More... | |
void | syncDiagonalOp (DiagonalOp op) |
Copy the elements in DiagonalOp op.real and op.imag to the persisent GPU memory. More... | |
Detailed Description
Precision-agnostic types and data structures for representing numbers, quantum states, and operators.
Macro Definition Documentation
◆ fromComplex
#define fromComplex | ( | comp | ) | qcomp(comp.real, comp.imag) |
Converts a Complex struct to a qcomp native type
◆ getStaticComplexMatrixN
#define getStaticComplexMatrixN | ( | numQubits, | |
re, | |||
im | |||
) |
Creates a ComplexMatrixN struct which lives in the stack and so does not need freeing, but cannot be returned beyond the calling scope.
That is, the .real and .imag arrays of the returned ComplexMatrixN live in the stack as opposed to that returned by createComplexMatrixN() (which live in the heap). Note the real and imag components must be wrapped in paranthesis, e.g.
ComplexMatrixN u = getStaticComplexMatrixN(1, ({{1,2},{3,4}}), ({{0}}));
Here is an example of an incorrect usage, since a 'local' ComplexMatrixN cannot leave the calling scope (otherwise inducing dangling pointers):
ComplexMatrixN getMyMatrix(void) { return getStaticComplexMatrixN(1, ({{1,2},{3,4}}), ({{0}})); }
This function is actually a single-line anonymous macro, so can be safely invoked within arguments to other functions, e.g.
multiQubitUnitary( qureg, (int[]) {0}, 1, getStaticComplexMatrixN(1, ({{1,0},{0,1}}), ({{0}})) );
The returned ComplexMatrixN can be accessed and modified in the same way as that returned by createComplexMatrixN(), e.g.
ComplexMatrixN u = getStaticComplexMatrixN(3, ({{0}}), ({{0}})); for (int i=0; i<8; i++) for (int j=0; j<8; j++) u.real[i][j] = .1;
Note that the first argument numQubits
must be a literal.
This macro is only callable in C, since it invokes the function bindArraysToStackComplexMatrixN() which is only callable in C.
◆ qcomp
#define qcomp |
A precision-agnostic operator-overloaded complex number type.
This is a complex analog of qreal and is of single, double or quad precision depending on the value of QuEST_PREC. It resolves to the native complex type provided by <complex.h> for both C99 and C++11, so can be used with operators. It can be constructed with qcomp(real, imag)
.
For example, in C,
and in C++,
Assuming QuEST_PREC=4
, qcomp will be 'complex long double' in C and 'complex<long double>' in C++.
Can be converted to/from Complex, the struct accepted by the QuEST interface, using toComplex and fromComplex.
◆ qreal
#define qreal double |
A precision-agnostic floating point number, as determined by QuEST_PREC. Is a single, double or quad precision float when QuEST_PREC is 1, 2 or 4 respectively.
◆ QuEST_PREC
#define QuEST_PREC 2 |
Sets the precision of qreal and qcomp, and generally that of the state-vectors stored by QuEST. QuEST_PREC
can be 1, 2 or 4 for single, double and quad precision - requires 4, 8 and 16 bytes per real & imag component per amplitude of the statevector respectively. This should be passed as a macro to the preprocessor during compilation, which overwrites the value explicitly defined in QuEST_precision.h. Note that quad precision is not compatible with most GPUs.
◆ toComplex
#define toComplex | ( | scalar | ) | ((Complex) {.real = creal(scalar), .imag = cimag(scalar)}) |
Creates a Complex struct, which can be passed to the QuEST API, from a qcomp
Enumeration Type Documentation
◆ pauliOpType
enum pauliOpType |
Function Documentation
◆ createCloneQureg()
Create a new Qureg which is an exact clone of the passed qureg, which can be either a statevector or a density matrix.
That is, it will have the same dimensions as the passed qureg and begin in an identical quantum state. This must be destroyed by the user later with destroyQureg()
- Returns
- an object representing the set of qubits
- Parameters
-
[in] qureg an existing qureg to be cloned [in] env object representing the execution environment (local, multinode etc)
Definition at line 64 of file QuEST.c.
References Qureg::isDensityMatrix, Qureg::numQubitsInStateVec, Qureg::numQubitsRepresented, qasm_setup(), statevec_cloneQureg(), and statevec_createQureg().
Referenced by TEST_CASE().
◆ createComplexMatrixN()
ComplexMatrixN createComplexMatrixN | ( | int | numQubits | ) |
Create (dynamically) a square complex matrix which can be passed to the multi-qubit general unitary functions.
The matrix will have dimensions (2^numQubits
) by (2^numQubits
), and all elements of .real and .imag are initialised to zero. The ComplexMatrixN must eventually be freed using destroyComplexMatrixN(). Like ComplexMatrix2 and ComplexMatrix4, the returned ComplexMatrixN is safe to return from functions.
One can instead use getStaticComplexMatrixN() to create a ComplexMatrixN struct in the stack (which doesn't need to be later destroyed).
- Parameters
-
[in] numQubits the number of qubits of which the returned ComplexMatrixN will correspond
- Returns
- a dynamic ComplexMatrixN struct, that is one where the .real and .imag fields are arrays kept in the heap and must be later destroyed.
Definition at line 1099 of file QuEST.c.
References ComplexMatrixN::imag, ComplexMatrixN::numQubits, ComplexMatrixN::real, validateMatrixInit(), and validateNumQubitsInMatrix().
Referenced by densmatr_mixMultiQubitKrausMap(), and TEST_CASE().
◆ createDensityQureg()
Create a Qureg for qubits which are represented by a density matrix, and can be in mixed states.
Allocates space for a density matrix of probability amplitudes, including space for temporary values to be copied from one other chunk if running the distributed version. Define properties related to the size of the set of qubits. initZeroState is automatically called allocation, so that the density qureg begins in the zero state |0><0|.
- Returns
- an object representing the set of qubits
- Parameters
-
[in] numQubits number of qubits in the system [in] env object representing the execution environment (local, multinode etc)
- Exceptions
-
invalidQuESTInputError if numQubits
<= 0, or ifnumQubits
is so large that the number of amplitudes cannot fit in a long long int type, or if in distributed mode, there are more nodes than elements in the would-be density-matrix
Definition at line 50 of file QuEST.c.
References initZeroState(), Qureg::isDensityMatrix, Qureg::numQubitsInStateVec, Qureg::numQubitsRepresented, QuESTEnv::numRanks, qasm_setup(), statevec_createQureg(), and validateNumQubitsInQureg().
Referenced by TEST_CASE().
◆ createDiagonalOp()
DiagonalOp createDiagonalOp | ( | int | numQubits, |
QuESTEnv | env | ||
) |
Creates a DiagonalOp representing a diagonal operator on the full Hilbert space of a Qureg.
This can only be applied to state-vectors or density matrices of an equal number of qubits, using applyDiagonalOp(). There is no requirement that the operator is unitary or Hermitian - any complex operator is allowed.
The operator is initialised to all zero.
This function allocates space for 2^numQubits
complex amplitudes, which are initially zero. This is the same cost as a state-vector of equal size. The elements should be modified with setDiagonalOpElems(). This memory must later be freed with destroyDiagonalOp().
In GPU mode, this function also creates persistent memory on the GPU. Hence, if not using setDiagonalOpElems() and instead modifying operator.real and .imag directly, the user must call thereafter call syncDiagonalOp() to modify the operator stored in the GPU.
In distributed mode, the memory for the diagonal operator is spread evenly between the available nodes, such that each node contains only operator.numElemsPerChunk complex values. Users must therefore exercise care in modifying .real and .imag directly, and should instead use initDiagonalOp(). E.g. the following is valid code when when distributed between TWO nodes:
// create {1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16} DiagonalOp op = createDiagonalOp(4, env); // 16 amplitudes total for (int i=0; i<8; i++) { if (env.rank == 0) op.real[i] = (i+1); if (env.rank == 1) op.real[i] = (i+1+8); }
- Returns
- a DiagonalOp instance, with 2^n-length .real and .imag arrays, initialised to zero
- Parameters
-
[in] numQubits number of qubit, informing the dimension of the operator. [in] env object representing the execution environment (local, multinode etc)
- Exceptions
-
invalidQuESTInputError if numQubits
<= 0, or ifnumQubits
is so large that the number of elements cannot fit in a long long int type, or if in distributed mode, there are more nodes than elements in the operator
Definition at line 1267 of file QuEST.c.
References agnostic_createDiagonalOp(), QuESTEnv::numRanks, and validateNumQubitsInDiagOp().
Referenced by TEST_CASE().
◆ createPauliHamil()
PauliHamil createPauliHamil | ( | int | numQubits, |
int | numSumTerms | ||
) |
Create a PauliHamil
instance, which is a Hamiltonian expressed as a real-weighted sum of products of Pauli operators.
This is merely an encapsulation of the multiple parameters of functions like applyPauliSum().
The Pauli operators (PauliHamil.pauliCodes
) are all initialised to identity (PAULI_I
), but the coefficients (PauliHamil.termCoeffs
) are not initialised. The Hamiltonian can be used (e.g. in applyPauliHamil() and applyTrotterCircuit()) with Qureg
instances of the same number of qubits.
The returned dynamic PauliHamil
instance must later be freed via destroyPauliHamil().
- Parameters
-
[in] numQubits the number of qubits on which this Hamiltonian acts [in] numSumTerms the number of weighted terms in the sum, or the number of Pauli products
- Returns
- a dynamic
PauliHamil
struct, with fieldspauliCodes
andtermCoeffs
stored in the heap
- Exceptions
-
invalidQuESTInputError if numQubits
<= 0, ornumSumTerms
<= 0.
Definition at line 1147 of file QuEST.c.
References PauliHamil::numQubits, PauliHamil::numSumTerms, PAULI_I, PauliHamil::pauliCodes, PauliHamil::termCoeffs, and validateHamilParams().
Referenced by createPauliHamilFromFile(), and TEST_CASE().
◆ createPauliHamilFromFile()
PauliHamil createPauliHamilFromFile | ( | char * | fn | ) |
Create a PauliHamil
instance, a real-weighted sum of products of Pauli operators, populated with the data in filename fn
.
Each line in the plaintext file is interpreted as a separate product of Pauli operators in the sum, and is a space-separated list with format
c p1 p2 p3 ... pN
where c
is the real coefficient of the term, and p1
... pN
are numbers 0
, 1
, 2
, 3
to indicate identity, pauliX, pauliY and pauliZ operators respectively, acting on qubits 0
through N-1
(all qubits). For example, the file containing
0.31 1 0 1 2 -0.2 3 2 0 0
encodes a two-term four-qubit Hamiltonian .
The number of qubits and terms are inferred from the file. The created Hamiltonian can be used just like one created via createPauliHamil().
The returned dynamic PauliHamil
instance must later be freed via destroyPauliHamil().
- Parameters
-
[in] fn filename of the plaintext file specifying the pauli operators and coefficients
- Returns
- a dynamic
PauliHamil
struct, with fieldspauliCodes
andtermCoeffs
stored in the heap
- Exceptions
-
invalidQuESTInputError if the file cannot be read, or is not correctly formatted
Definition at line 1169 of file QuEST.c.
References createPauliHamil(), PauliHamil::pauliCodes, PauliHamil::termCoeffs, validateFileOpened(), validateHamilFileCoeffParsed(), validateHamilFileParams(), validateHamilFilePauliCode(), and validateHamilFilePauliParsed().
Referenced by TEST_CASE().
◆ createQuESTEnv()
QuESTEnv createQuESTEnv | ( | void | ) |
Create the QuEST execution environment.
This should be called only once, and the environment should be freed with destroyQuESTEnv at the end of the user's code. If something needs to be done to set up the execution environment, such as initializing MPI when running in distributed mode, it is handled here.
- Returns
- object representing the execution environment. A single instance is used for each program
Definition at line 129 of file QuEST_cpu_distributed.c.
References GPUExists(), QuESTEnv::numRanks, QuESTEnv::rank, seedQuESTDefault(), and validateNumRanks().
Referenced by main().
◆ createQureg()
Create a Qureg object representing a set of qubits which will remain in a pure state.
Allocate space for state vector of probability amplitudes, including space for temporary values to be copied from one other chunk if running the distributed version. Define properties related to the size of the set of qubits. The qubits are initialised in the zero state (i.e. initZeroState is automatically called)
- Returns
- an object representing the set of qubits
- Parameters
-
[in] numQubits number of qubits in the system [in] env object representing the execution environment (local, multinode etc)
- Exceptions
-
invalidQuESTInputError if numQubits
<= 0, or ifnumQubits
is so large that the number of amplitudes cannot fit in a long long int type, or if in distributed mode, there are more nodes than elements in the would-be state-vector
Definition at line 36 of file QuEST.c.
References initZeroState(), Qureg::isDensityMatrix, Qureg::numQubitsInStateVec, Qureg::numQubitsRepresented, QuESTEnv::numRanks, qasm_setup(), statevec_createQureg(), and validateNumQubitsInQureg().
Referenced by TEST_CASE().
◆ destroyComplexMatrixN()
void destroyComplexMatrixN | ( | ComplexMatrixN | matr | ) |
Destroy a ComplexMatrixN instance created with createComplexMatrixN()
It is invalid to attempt to destroy a matrix created with getStaticComplexMatrixN().
- Parameters
-
[in] matr the dynamic matrix (created with createComplexMatrixN()) to deallocate
- Exceptions
-
invalidQuESTInputError if matr
was not yet allocated.malloc_error if matr
was static (created with getStaticComplexMatrixN())
Definition at line 1120 of file QuEST.c.
References ComplexMatrixN::imag, ComplexMatrixN::numQubits, ComplexMatrixN::real, and validateMatrixInit().
Referenced by densmatr_mixMultiQubitKrausMap(), and TEST_CASE().
◆ destroyDiagonalOp()
void destroyDiagonalOp | ( | DiagonalOp | op, |
QuESTEnv | env | ||
) |
Destroys a DiagonalOp created with createDiagonalOp(), freeing its memory.
- Parameters
-
[in] op the diagonal operator to destroy [in] env object representing the execution environment (local, multinode etc)
- Exceptions
-
invalidQuESTInputError if op
was not created
Definition at line 1273 of file QuEST.c.
References agnostic_destroyDiagonalOp(), and validateDiagOpInit().
Referenced by TEST_CASE().
◆ destroyPauliHamil()
void destroyPauliHamil | ( | PauliHamil | hamil | ) |
Destroy a PauliHamil
instance, created with either createPauliHamil() or createPauliHamilFromFile().
- Parameters
-
[in] hamil a dynamic PauliHamil
instantiation
Definition at line 1163 of file QuEST.c.
References PauliHamil::pauliCodes, and PauliHamil::termCoeffs.
Referenced by TEST_CASE(), validateHamilFileCoeffParsed(), validateHamilFilePauliCode(), and validateHamilFilePauliParsed().
◆ destroyQuESTEnv()
void destroyQuESTEnv | ( | QuESTEnv | env | ) |
Destroy the QuEST environment.
If something needs to be done to clean up the execution environment, such as finalizing MPI when running in distributed mode, it is handled here
- Parameters
-
[in] env object representing the execution environment. A single instance is used for each program
Definition at line 172 of file QuEST_cpu_distributed.c.
Referenced by main().
◆ destroyQureg()
Deallocate a Qureg object representing a set of qubits.
Free memory allocated to state vector of probability amplitudes, including temporary vector for values copied from another chunk if running the distributed version.
- Parameters
-
[in,out] qureg object to be deallocated [in] env object representing the execution environment (local, multinode etc)
Definition at line 77 of file QuEST.c.
References qasm_free(), and statevec_destroyQureg().
Referenced by TEST_CASE().
◆ initComplexMatrixN()
void initComplexMatrixN | ( | ComplexMatrixN | m, |
qreal | real[][1<< m.numQubits], | ||
qreal | imag[][1<< m.numQubits] | ||
) |
Initialises a ComplexMatrixN instance to have the passed real
and imag
values.
This allows succint population of any-sized ComplexMatrixN, e.g. through 2D arrays:
ComplexMatrixN m = createComplexMatrixN(3); initComplexMatrixN(m, (qreal[8][8]) {{1,2,3,4,5,6,7,8}, {0}}, (qreal[8][8]) {{0}});
m
can be created by either createComplexMatrixN() or getStaticComplexMatrixN().
This function is only callable in C, since C++ signatures cannot contain variable-length 2D arrays
- Parameters
-
[in] m the matrix to initialise [in] real matrix of real values; can be 2D array of array of pointers [in] imag matrix of imaginary values; can be 2D array of array of pointers
- Exceptions
-
invalidQuESTInputError if m
has not been allocated (e.g. with createComplexMatrixN())
Definition at line 1136 of file QuEST.c.
References ComplexMatrixN::imag, ComplexMatrixN::numQubits, ComplexMatrixN::real, and validateMatrixInit().
◆ initDiagonalOp()
void initDiagonalOp | ( | DiagonalOp | op, |
qreal * | real, | ||
qreal * | imag | ||
) |
Updates the entire DiagonalOp op
with the given elements, of which there must be 2^op.numQubits
.
In GPU mode, this updates both the persistent GPU memory, and the arrays op.real
and op.imag
In distributed mode, this function assumes real
and imag
exist fully on every node.
- Parameters
-
[in,out] op the diagonal operator to modify [in] real the real components of the full set of new elements [in] imag the imaginary components of the full set of new elements
- Exceptions
-
invalidQuESTInputError if op
was not created
Definition at line 1286 of file QuEST.c.
References agnostic_setDiagonalOpElems(), DiagonalOp::numQubits, and validateDiagOpInit().
Referenced by TEST_CASE().
◆ initPauliHamil()
void initPauliHamil | ( | PauliHamil | hamil, |
qreal * | coeffs, | ||
enum pauliOpType * | codes | ||
) |
Initialise a PauliHamil
instance with the given term coefficients and Pauli codes (one for every qubit in every term).
coeffs
and codes
encode a weighted sum of Pauli operators, with the same format as other QuEST functions (like calcExpecPauliSum()).
hamil
must be already created with createPauliHamil(), or createPauliHamilFromFile())
- Parameters
-
[in,out] hamil an already created PauliHamil instance to be modified [in] coeffs a length-hamil.numSumTerms array of coefficients [in] codes a length-hamil.numSumTerms*hamil.numQubits array of Pauli codes
- Exceptions
-
invalidQuESTInputError if hamil
has invalid parameters (numQubits
<= 0,numSumTerms
<= 0), or if any code incodes
is not a valid Pauli code.
Definition at line 1253 of file QuEST.c.
References PauliHamil::numQubits, PauliHamil::numSumTerms, PauliHamil::pauliCodes, PauliHamil::termCoeffs, validateHamilParams(), and validatePauliCodes().
Referenced by TEST_CASE().
◆ setDiagonalOpElems()
void setDiagonalOpElems | ( | DiagonalOp | op, |
long long int | startInd, | ||
qreal * | real, | ||
qreal * | imag, | ||
long long int | numElems | ||
) |
Modifies a subset (starting at index startInd
) of the elements in DiagonalOp op
with the given elements, of which there are numElems
.
In GPU mode, this updates both the persistent GPU memory, and the arrays op.real
and op.imag
In distributed mode, this function assumes the subset real
and imag
exist (at least) on the node containing the ultimately updated elements. For example, below is the correct way to modify the full 8 elements of op
when split between 2 nodes.
DiagonalOp op = createDiagonalOp(3, env); qreal re[] = {1,2,3,4}; qreal im[] = {1,2,3,4}; setDiagonalOpElems(op, 0, re, im, 4); // modify re and im to the next set of elements setDiagonalOpElems(op, 4, re, im, 4);
In this way, one can avoid a single node containing all new elements which might not fit. If more elements are passed than exist on an individual node, each node merely ignores the additional elements.
- Parameters
-
[in,out] op the diagonal operator to modify the elements of [in] startInd the starting index (globally) of the subset of elements to modify [in] real the real components of the new elements [in] imag the imaginary components of the new elements [in] numElems the number of new elements (the length of real
andimag
)
- Exceptions
-
invalidQuESTInputError if op
was not created, or ifstartInd
is an invalid index, or ifnumElems
is an invalid number of elements, or if there less thannumElems
elements in the operator afterstartInd
.
Definition at line 1292 of file QuEST.c.
References agnostic_setDiagonalOpElems(), validateDiagOpInit(), and validateNumElems().
Referenced by TEST_CASE().
◆ syncDiagonalOp()
void syncDiagonalOp | ( | DiagonalOp | op | ) |
Copy the elements in DiagonalOp op.real
and op.imag
to the persisent GPU memory.
This updates the GPU memory for op
with any manual changes made to op.real
and op.imag
.
Note if users just modify the diagonal operator to values known a priori, they should instead use initDiagonalOp() or setDiagonalOpElems()
This function has no effect in other modes besides GPU mode.
- Parameters
-
[in,out] op the diagonal operator to synch to GPU
- Exceptions
-
invalidQuESTInputError if op
was not created
Definition at line 1280 of file QuEST.c.
References agnostic_syncDiagonalOp(), and validateDiagOpInit().
Referenced by TEST_CASE().