Operators

Non-physical operators which may be non-unitary, non-norm-preserving, even non-Hermitian. More...

Functions

void applyDiagonalOp (Qureg qureg, DiagonalOp op)
 Apply a diagonal complex operator, which is possibly non-unitary and non-Hermitian, on the entire qureg,
More...
 
void applyMatrix2 (Qureg qureg, int targetQubit, ComplexMatrix2 u)
 Apply a general 2-by-2 matrix, which may be non-unitary. More...
 
void applyMatrix4 (Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u)
 Apply a general 4-by-4 matrix, which may be non-unitary. More...
 
void applyMatrixN (Qureg qureg, int *targs, int numTargs, ComplexMatrixN u)
 Apply a general N-by-N matrix, which may be non-unitary, on any number of target qubits. More...
 
void applyMultiControlledMatrixN (Qureg qureg, int *ctrls, int numCtrls, int *targs, int numTargs, ComplexMatrixN u)
 Apply a general N-by-N matrix, which may be non-unitary, with additional controlled qubits. More...
 
void applyPauliHamil (Qureg inQureg, PauliHamil hamil, Qureg outQureg)
 Modifies outQureg to be the result of applying PauliHamil (a Hermitian but not necessarily unitary operator) to inQureg. More...
 
void applyPauliSum (Qureg inQureg, enum pauliOpType *allPauliCodes, qreal *termCoeffs, int numSumTerms, Qureg outQureg)
 Modifies outQureg to be the result of applying the weighted sum of Pauli products (a Hermitian but not necessarily unitary operator) to inQureg. More...
 
void applyTrotterCircuit (Qureg qureg, PauliHamil hamil, qreal time, int order, int reps)
 Applies a trotterisation of unitary evolution $ \exp(-i \, \text{hamil} \, \text{time}) $ to qureg. More...
 

Detailed Description

Non-physical operators which may be non-unitary, non-norm-preserving, even non-Hermitian.

Function Documentation

◆ applyDiagonalOp()

void applyDiagonalOp ( Qureg  qureg,
DiagonalOp  op 
)

Apply a diagonal complex operator, which is possibly non-unitary and non-Hermitian, on the entire qureg,

Parameters
[in,out]quregthe state to operate the diagonal operator upon
[in]opthe diagonal operator to apply
Exceptions
invalidQuESTInputErrorif op was not created, or if op acts on a different number of qubits than qureg represents
Author
Tyson Jones

Definition at line 887 of file QuEST.c.

887  {
888  validateDiagonalOp(qureg, op, __func__);
889 
890  if (qureg.isDensityMatrix)
891  densmatr_applyDiagonalOp(qureg, op);
892  else
893  statevec_applyDiagonalOp(qureg, op);
894 
895  qasm_recordComment(qureg, "Here, the register was modified to an undisclosed and possibly unphysical state (via applyDiagonalOp).");
896 }

References densmatr_applyDiagonalOp(), Qureg::isDensityMatrix, qasm_recordComment(), statevec_applyDiagonalOp(), and validateDiagonalOp().

Referenced by TEST_CASE().

◆ applyMatrix2()

void applyMatrix2 ( Qureg  qureg,
int  targetQubit,
ComplexMatrix2  u 
)

Apply a general 2-by-2 matrix, which may be non-unitary.

The matrix is left-multiplied onto the state, for both state-vectors and density matrices. Hence, this function differs from unitary() by more than just permitting a non-unitary matrix.

This function may leave qureg is an unnormalised state.


Parameters
[in,out]quregobject representing the set of all qubits
[in]targetQubitqubit to operate u upon
[in]umatrix to apply
Exceptions
invalidQuESTInputErrorif targetQubit is outside [0, qureg.numQubitsRepresented).
Author
Tyson Jones

Definition at line 844 of file QuEST.c.

844  {
845  validateTarget(qureg, targetQubit, __func__);
846 
847  // actually just left-multiplies any complex matrix
848  statevec_unitary(qureg, targetQubit, u);
849 
850  qasm_recordComment(qureg, "Here, an undisclosed 2-by-2 matrix (possibly non-unitary) was multiplied onto qubit %d", targetQubit);
851 }

References qasm_recordComment(), statevec_unitary(), and validateTarget().

Referenced by TEST_CASE().

◆ applyMatrix4()

void applyMatrix4 ( Qureg  qureg,
int  targetQubit1,
int  targetQubit2,
ComplexMatrix4  u 
)

Apply a general 4-by-4 matrix, which may be non-unitary.

The matrix is left-multiplied onto the state, for both state-vectors and density matrices. Hence, this function differs from twoQubitUnitary() by more than just permitting a non-unitary matrix.

targetQubit1 is treated as the least significant qubit in u, such that a row in u is dotted with the vector $ |\text{targetQubit2} \;\; \text{targetQubit1}\rangle : \{ |00\rangle, |01\rangle, |10\rangle, |11\rangle \} $

For example,

applyMatrix4(qureg, a, b, u);

will invoke multiplication

\[ \begin{pmatrix} u_{00} & u_{01} & u_{02} & u_{03} \\ u_{10} & u_{11} & u_{12} & u_{13} \\ u_{20} & u_{21} & u_{22} & u_{23} \\ u_{30} & u_{31} & u_{32} & u_{33} \end{pmatrix} \begin{pmatrix} |ba\rangle = |00\rangle \\ |ba\rangle = |01\rangle \\ |ba\rangle = |10\rangle \\ |ba\rangle = |11\rangle \end{pmatrix} \]

This function may leave qureg is an unnormalised state.

Note that in distributed mode, this routine requires that each node contains at least 4 amplitudes. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q/4 nodes.


Parameters
[in,out]quregobject representing the set of all qubits
[in]targetQubit1first qubit to operate on, treated as least significant in u
[in]targetQubit2second qubit to operate on, treated as most significant in u
[in]umatrix to apply
Exceptions
invalidQuESTInputErrorif targetQubit1 or targetQubit2 are outside [0, qureg.numQubitsRepresented), or if targetQubit1 equals targetQubit2, or if each node cannot fit 4 amplitudes in distributed mode.
Author
Tyson Jones

Definition at line 853 of file QuEST.c.

853  {
854  validateMultiTargets(qureg, (int []) {targetQubit1, targetQubit2}, 2, __func__);
855  validateMultiQubitMatrixFitsInNode(qureg, 2, __func__);
856 
857  // actually just left-multiplies any complex matrix
858  statevec_twoQubitUnitary(qureg, targetQubit1, targetQubit2, u);
859 
860  qasm_recordComment(qureg, "Here, an undisclosed 4-by-4 matrix (possibly non-unitary) was multiplied onto qubits %d and %d", targetQubit1, targetQubit2);
861 }

References qasm_recordComment(), statevec_twoQubitUnitary(), validateMultiQubitMatrixFitsInNode(), and validateMultiTargets().

Referenced by TEST_CASE().

◆ applyMatrixN()

void applyMatrixN ( Qureg  qureg,
int *  targs,
int  numTargs,
ComplexMatrixN  u 
)

Apply a general N-by-N matrix, which may be non-unitary, on any number of target qubits.

The matrix is left-multiplied onto the state, for both state-vectors and density matrices. Hence, this function differs from multiQubitUnitary() by more than just permitting a non-unitary matrix.

The first target qubit in targs is treated as least significant in u. For example,

applyMatrixN(qureg, (int []) {a, b, c}, 3, u);

will invoke multiplication

\[ \begin{pmatrix} u_{00} & u_{01} & u_{02} & u_{03} & u_{04} & u_{05} & u_{06} & u_{07} \\ u_{10} & u_{11} & u_{12} & u_{13} & u_{14} & u_{15} & u_{16} & u_{17} \\ u_{20} & u_{21} & u_{22} & u_{23} & u_{24} & u_{25} & u_{26} & u_{27} \\ u_{30} & u_{31} & u_{32} & u_{33} & u_{34} & u_{35} & u_{36} & u_{37} \\ u_{40} & u_{41} & u_{42} & u_{43} & u_{44} & u_{45} & u_{46} & u_{47} \\ u_{50} & u_{51} & u_{52} & u_{53} & u_{54} & u_{55} & u_{56} & u_{57} \\ u_{60} & u_{61} & u_{62} & u_{63} & u_{64} & u_{65} & u_{66} & u_{67} \\ u_{70} & u_{71} & u_{72} & u_{73} & u_{74} & u_{75} & u_{76} & u_{77} \\ \end{pmatrix} \begin{pmatrix} |cba\rangle = |000\rangle \\ |cba\rangle = |001\rangle \\ |cba\rangle = |010\rangle \\ |cba\rangle = |011\rangle \\ |cba\rangle = |100\rangle \\ |cba\rangle = |101\rangle \\ |cba\rangle = |110\rangle \\ |cba\rangle = |111\rangle \end{pmatrix} \]

This function may leave qureg is an unnormalised state.

The passed ComplexMatrix must be a compatible size with the specified number of target qubits, otherwise an error is thrown.

Note that in multithreaded mode, each thread will clone 2^numTargs amplitudes, and store these in the runtime stack. Using t threads, the total memory overhead of this function is t*2^numTargs. For many targets (e.g. 16 qubits), this may cause a stack-overflow / seg-fault (e.g. on a 1 MiB stack).

Note too that in distributed mode, this routine requires that each node contains at least 2^numTargs amplitudes in the register. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q / 2^numTargs nodes.

Parameters
[in,out]quregobject representing the set of all qubits
[in]targsa list of the target qubits, ordered least significant to most in u
[in]numTargsthe number of target qubits
[in]umatrix to apply
Exceptions
invalidQuESTInputErrorif any index in targs is outside of [0, qureg.numQubitsRepresented), or if targs are not unique, or if u is not of a compatible size with numTargs, or if a node cannot fit the required number of target amplitudes in distributed mode.
Author
Tyson Jones

Definition at line 863 of file QuEST.c.

863  {
864  validateMultiTargets(qureg, targs, numTargs, __func__);
865  validateMultiQubitMatrix(qureg, u, numTargs, __func__);
866 
867  // actually just left-multiplies any complex matrix
868  statevec_multiQubitUnitary(qureg, targs, numTargs, u);
869 
870  int dim = (1 << numTargs);
871  qasm_recordComment(qureg, "Here, an undisclosed %d-by-%d matrix (possibly non-unitary) was multiplied onto %d undisclosed qubits", dim, dim, numTargs);
872 }

References qasm_recordComment(), statevec_multiQubitUnitary(), validateMultiQubitMatrix(), and validateMultiTargets().

Referenced by TEST_CASE().

◆ applyMultiControlledMatrixN()

void applyMultiControlledMatrixN ( Qureg  qureg,
int *  ctrls,
int  numCtrls,
int *  targs,
int  numTargs,
ComplexMatrixN  u 
)

Apply a general N-by-N matrix, which may be non-unitary, with additional controlled qubits.

The matrix is left-multiplied onto the state, for both state-vectors and density matrices. Hence, this function differs from multiControlledMultiQubitUnitary() by more than just permitting a non-unitary matrix.

This function may leave qureg is an unnormalised state.

Any number of control and target qubits can be specified. This effects the many-qubit matrix

\[ \begin{pmatrix} 1 \\ & 1 \\\ & & \ddots \\ & & & u_{00} & u_{01} & \dots \\ & & & u_{10} & u_{11} & \dots \\ & & & \vdots & \vdots & \ddots \end{pmatrix} \]

on the control and target qubits.

The target qubits in targs are treated as ordered least significant to most significant in u.

The passed ComplexMatrix must be a compatible size with the specified number of target qubits, otherwise an error is thrown.

Note that in multithreaded mode, each thread will clone 2^numTargs amplitudes, and store these in the runtime stack. Using t threads, the total memory overhead of this function is t*2^numTargs. For many targets (e.g. 16 qubits), this may cause a stack-overflow / seg-fault (e.g. on a 1 MiB stack).

Note that in distributed mode, this routine requires that each node contains at least 2^numTargs amplitudes. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q / 2^numTargs nodes.

Parameters
[in,out]quregobject representing the set of all qubits
[in]ctrlsa list of the control qubits
[in]numCtrlsthe number of control qubits
[in]targsa list of the target qubits, ordered least to most significant
[in]numTargsthe number of target qubits
[in]umatrix to apply
Exceptions
invalidQuESTInputErrorif any index in ctrls and targs is outside of [0, qureg.numQubitsRepresented), or if ctrls and targs are not unique, or if matrix u is not a compatible size with numTargs, or if a node cannot fit the required number of target amplitudes in distributed mode.
Author
Tyson Jones

Definition at line 874 of file QuEST.c.

874  {
875  validateMultiControlsMultiTargets(qureg, ctrls, numCtrls, targs, numTargs, __func__);
876  validateMultiQubitMatrix(qureg, u, numTargs, __func__);
877 
878  // actually just left-multiplies any complex matrix
879  long long int ctrlMask = getQubitBitMask(ctrls, numCtrls);
880  statevec_multiControlledMultiQubitUnitary(qureg, ctrlMask, targs, numTargs, u);
881 
882  int numTot = numTargs + numCtrls;
883  int dim = (1 << numTot );
884  qasm_recordComment(qureg, "Here, an undisclosed %d-by-%d matrix (possibly non-unitary, and including %d controlled qubits) was multiplied onto %d undisclosed qubits", dim, dim, numCtrls, numTot);
885 }

References getQubitBitMask(), qasm_recordComment(), statevec_multiControlledMultiQubitUnitary(), validateMultiControlsMultiTargets(), and validateMultiQubitMatrix().

Referenced by TEST_CASE().

◆ applyPauliHamil()

void applyPauliHamil ( Qureg  inQureg,
PauliHamil  hamil,
Qureg  outQureg 
)

Modifies outQureg to be the result of applying PauliHamil (a Hermitian but not necessarily unitary operator) to inQureg.

Note that afterward, outQureg may no longer be normalised and ergo not a statevector or density matrix. Users must therefore be careful passing outQureg to other QuEST functions which assume normalisation in order to function correctly.

This is merely an encapsulation of applyPauliSum(), which can refer to for elaborated doc.

Letting hamil be expressed as $ \alpha = \sum_i c_i \otimes_j^{N} \hat{\sigma}_{i,j} $ (where $ c_i \in $ hamil.termCoeffs and $ N = $ hamil.numQubits), this function effects $ \alpha | \psi \rangle $ on statevector $ |\psi\rangle $ and $\alpha \rho$ (left matrix multiplication) on density matrix $ \rho $.

In theory, inQureg is unchanged though its state is temporarily modified and is reverted by re-applying Paulis (XX=YY=ZZ=I), so may see a change by small numerical errors. The initial state in outQureg is not used.

inQureg and outQureg must both be state-vectors, or both density matrices, of equal dimensions to hamil. inQureg cannot be outQureg.

This function works by applying each Pauli product in hamil to inQureg in turn, and adding the resulting state (weighted by a coefficient in termCoeffs) to the initially-blanked outQureg. Ergo it should scale with the total number of Pauli operators specified (excluding identities), and the qureg dimension.

Parameters
[in]inQuregthe register containing the state which outQureg will be set to, under the action of hamil. inQureg should be unchanged, though may vary slightly due to numerical error.
[in]hamila weighted sum of products of pauli operators
[out]outQuregthe qureg to modify to be the result of applyling hamil to the state in inQureg
Exceptions
invalidQuESTInputErrorif any code in hamil.pauliCodes is not a valid Pauli code, or if numSumTerms <= 0, or if inQureg is not of the same type and dimensions as outQureg and hamil
Author
Tyson Jones

Definition at line 819 of file QuEST.c.

819  {
820  validateMatchingQuregTypes(inQureg, outQureg, __func__);
821  validateMatchingQuregDims(inQureg, outQureg, __func__);
822  validatePauliHamil(hamil, __func__);
823  validateMatchingQuregPauliHamilDims(inQureg, hamil, __func__);
824 
825  statevec_applyPauliSum(inQureg, hamil.pauliCodes, hamil.termCoeffs, hamil.numSumTerms, outQureg);
826 
827  qasm_recordComment(outQureg, "Here, the register was modified to an undisclosed and possibly unphysical state (applyPauliHamil).");
828 }

References PauliHamil::numSumTerms, PauliHamil::pauliCodes, qasm_recordComment(), statevec_applyPauliSum(), PauliHamil::termCoeffs, validateMatchingQuregDims(), validateMatchingQuregPauliHamilDims(), validateMatchingQuregTypes(), and validatePauliHamil().

Referenced by TEST_CASE().

◆ applyPauliSum()

void applyPauliSum ( Qureg  inQureg,
enum pauliOpType allPauliCodes,
qreal termCoeffs,
int  numSumTerms,
Qureg  outQureg 
)

Modifies outQureg to be the result of applying the weighted sum of Pauli products (a Hermitian but not necessarily unitary operator) to inQureg.

Note that afterward, outQureg may no longer be normalised and ergo not a statevector or density matrix. Users must therefore be careful passing outQureg to other QuEST functions which assume normalisation in order to function correctly.

Letting $ \alpha = \sum_i c_i \otimes_j^{N} \hat{\sigma}_{i,j} $ be the operators indicated by allPauliCodes (where $ c_i \in $ termCoeffs and $ N = $ qureg.numQubitsRepresented), this function effects $ \alpha | \psi \rangle $ on statevector $ |\psi\rangle $ and $\alpha \rho$ (left matrix multiplication) on density matrix $ \rho $.

allPauliCodes is an array of length numSumTerms*qureg.numQubitsRepresented which specifies which Pauli operators to apply, where 0 = PAULI_I, 1 = PAULI_X, 2 = PAULI_Y, 3 = PAULI_Z. For each sum term, a Pauli operator must be specified for EVERY qubit in qureg; each set of numSumTerms operators will be grouped into a product. termCoeffs is an arrray of length numSumTerms containing the term coefficients. For example, on a 3-qubit statevector,

int paulis[6] = {PAULI_X, PAULI_I, PAULI_I,  PAULI_X, PAULI_Y, PAULI_Z};
qreal coeffs[2] = {1.5, -3.6};
applyPauliSum(inQureg, paulis, coeffs, 2, outQureg);

will apply Hermitian operation $ (1.5 X I I - 3.6 X Y Z) $ (where in this notation, the left-most operator applies to the least-significant qubit, i.e. that with index 0).

In theory, inQureg is unchanged though its state is temporarily modified and is reverted by re-applying Paulis (XX=YY=ZZ=I), so may see a change by small numerical errors. The initial state in outQureg is not used.

inQureg and outQureg must both be state-vectors, or both density matrices, of equal dimensions. inQureg cannot be outQureg.

This function works by applying each Pauli product to inQureg in turn, and adding the resulting state (weighted by a coefficient in termCoeffs) to the initially-blanked outQureg. Ergo it should scale with the total number of Pauli operators specified (excluding identities), and the qureg dimension.

Parameters
[in]inQuregthe register containing the state which outQureg will be set to, under the action of the Hermitiain operator specified by the Pauli codes. inQureg should be unchanged, though may vary slightly due to numerical error.
[in]allPauliCodesa list of the Pauli codes (0=PAULI_I, 1=PAULI_X, 2=PAULI_Y, 3=PAULI_Z) of all Paulis involved in the products of terms. A Pauli must be specified for each qubit in the register, in every term of the sum.
[in]termCoeffsThe coefficients of each term in the sum of Pauli products
[in]numSumTermsThe total number of Pauli products specified
[out]outQuregthe qureg to modify to be the result of applyling the weighted Pauli sum operator to the state in inQureg
Exceptions
invalidQuESTInputErrorif any code in allPauliCodes is not in {0,1,2,3}, or if numSumTerms <= 0, or if inQureg is not of the same type and dimensions as outQureg
Author
Tyson Jones

Definition at line 808 of file QuEST.c.

808  {
809  validateMatchingQuregTypes(inQureg, outQureg, __func__);
810  validateMatchingQuregDims(inQureg, outQureg, __func__);
811  validateNumPauliSumTerms(numSumTerms, __func__);
812  validatePauliCodes(allPauliCodes, numSumTerms*inQureg.numQubitsRepresented, __func__);
813 
814  statevec_applyPauliSum(inQureg, allPauliCodes, termCoeffs, numSumTerms, outQureg);
815 
816  qasm_recordComment(outQureg, "Here, the register was modified to an undisclosed and possibly unphysical state (applyPauliSum).");
817 }

References Qureg::numQubitsRepresented, qasm_recordComment(), statevec_applyPauliSum(), validateMatchingQuregDims(), validateMatchingQuregTypes(), validateNumPauliSumTerms(), and validatePauliCodes().

Referenced by TEST_CASE().

◆ applyTrotterCircuit()

void applyTrotterCircuit ( Qureg  qureg,
PauliHamil  hamil,
qreal  time,
int  order,
int  reps 
)

Applies a trotterisation of unitary evolution $ \exp(-i \, \text{hamil} \, \text{time}) $ to qureg.

This is a sequence of unitary operators, effected by multiRotatePauli(), which together approximate the action of full unitary-time evolution under the given Hamiltonian.

Notate $ \text{hamil} = \sum_j^N c_j \, \hat \sigma_j $ where $c_j$ is a real coefficient in hamil, $\hat \sigma_j$ is the corresponding product of Pauli operators, of which there are a total $N$. Then, order=1 performs first-order Trotterisation, whereby

\[ \exp(-i \, \text{hamil} \, \text{time}) \approx \prod\limits^{\text{reps}} \prod\limits_{j=1}^{N} \exp(-i \, c_j \, \text{time} \, \hat\sigma_j / \text{reps}) \]

order=2 performs the lowest order "symmetrized" Suzuki decomposition, whereby

\[ \exp(-i \, \text{hamil} \, \text{time}) \approx \prod\limits^{\text{reps}} \left[ \prod\limits_{j=1}^{N} \exp(-i \, c_j \, \text{time} \, \hat\sigma_j / (2 \, \text{reps})) \prod\limits_{j=N}^{1} \exp(-i \, c_j \, \text{time} \, \hat\sigma_j / (2 \, \text{reps})) \right] \]

Greater even values of order specify higher-order symmetrized decompositions $ S[\text{time}, \text{order}, \text{reps}] $ which satisfy

\[ S[\text{time}, \text{order}, 1] = \left( \prod\limits^2 S[p \, \text{time}, \text{order}-2, 1] \right) S[ (1-4p)\,\text{time}, \text{order}-2, 1] \left( \prod\limits^2 S[p \, \text{time}, \text{order}-2, 1] \right) \]

and

\[ S[\text{time}, \text{order}, \text{reps}] = \prod\limits^{\text{reps}} S[\text{time}/\text{reps}, \text{order}, 1] \]

where $ p = \left( 4 - 4^{1/(\text{order}-1)} \right)^{-1} $.

These formulations are taken from 'Finding Exponential Product Formulas of Higher Orders', Naomichi Hatano and Masuo Suzuki (2005) (arXiv).

Note that the applied Trotter circuit is captured by QASM, if QASM logging is enabled on qureg.

Parameters
[in,out]quregthe register to modify under the approximate unitary-time evolution
[in]hamilthe hamiltonian under which to approxiamte unitary-time evolution
[in]timethe target evolution time, which is permitted to be both positive and negative.
[in]orderthe order of Trotter-Suzuki decomposition to use. Higher orders (necessarily even) are more accurate but prescribe an exponentially increasing number of gates.
[in]repsthe number of repetitions of the decomposition of the given order. This improves the accuracy but prescribes a linearly increasing number of gates.
Exceptions
invalidQuESTInputErrorif qureg.numQubitsRepresented != hamil.numQubits, or hamil contains invalid parameters or Pauli codes, or if order is not in {1, 2, 4, 6, ...} or if reps <= 0.
Author
Tyson Jones

Definition at line 830 of file QuEST.c.

830  {
831  validateTrotterParams(order, reps, __func__);
832  validatePauliHamil(hamil, __func__);
833  validateMatchingQuregPauliHamilDims(qureg, hamil, __func__);
834 
835  qasm_recordComment(qureg,
836  "Beginning of Trotter circuit (time %g, order %d, %d repetitions).",
837  time, order, reps);
838 
839  agnostic_applyTrotterCircuit(qureg, hamil, time, order, reps);
840 
841  qasm_recordComment(qureg, "End of Trotter circuit");
842 }

References agnostic_applyTrotterCircuit(), qasm_recordComment(), validateMatchingQuregPauliHamilDims(), validatePauliHamil(), and validateTrotterParams().

Referenced by TEST_CASE().

void validateTarget(Qureg qureg, int targetQubit, const char *caller)
void validateMultiQubitMatrixFitsInNode(Qureg qureg, int numTargets, const char *caller)
void statevec_twoQubitUnitary(Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u)
Definition: QuEST_common.c:517
void statevec_unitary(Qureg qureg, int targetQubit, ComplexMatrix2 u)
void statevec_multiControlledMultiQubitUnitary(Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u)
This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks ...
void validateNumPauliSumTerms(int numTerms, const char *caller)
void validateDiagonalOp(Qureg qureg, DiagonalOp op, const char *caller)
qreal * termCoeffs
The coefficient of each Pauli product. This is a length numSumTerms array.
Definition: QuEST.h:164
void agnostic_applyTrotterCircuit(Qureg qureg, PauliHamil hamil, qreal time, int order, int reps)
Definition: QuEST_common.c:773
enum pauliOpType * pauliCodes
The Pauli operators acting on each qubit, flattened over every operator.
Definition: QuEST.h:162
void statevec_applyDiagonalOp(Qureg qureg, DiagonalOp op)
Definition: QuEST_cpu.c:3661
void validateMultiTargets(Qureg qureg, int *targetQubits, int numTargetQubits, const char *caller)
void validateMatchingQuregDims(Qureg qureg1, Qureg qureg2, const char *caller)
int numSumTerms
The number of terms in the weighted sum, or the number of Pauli products.
Definition: QuEST.h:166
long long int getQubitBitMask(int *qubits, int numQubits)
Definition: QuEST_common.c:44
void qasm_recordComment(Qureg qureg, char *comment,...)
Definition: QuEST_qasm.c:120
void statevec_multiQubitUnitary(Qureg qureg, int *targets, int numTargets, ComplexMatrixN u)
Definition: QuEST_common.c:529
void statevec_applyPauliSum(Qureg inQureg, enum pauliOpType *allCodes, qreal *termCoeffs, int numSumTerms, Qureg outQureg)
Definition: QuEST_common.c:494
void validatePauliHamil(PauliHamil hamil, const char *caller)
void validateMatchingQuregPauliHamilDims(Qureg qureg, PauliHamil hamil, const char *caller)
int isDensityMatrix
Whether this instance is a density-state representation.
Definition: QuEST.h:206
void validateMatchingQuregTypes(Qureg qureg1, Qureg qureg2, const char *caller)
int numQubitsRepresented
The number of qubits represented in either the state-vector or density matrix.
Definition: QuEST.h:208
void validateMultiControlsMultiTargets(Qureg qureg, int *controlQubits, int numControlQubits, int *targetQubits, int numTargetQubits, const char *caller)
void validateMultiQubitMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char *caller)
void validateTrotterParams(int order, int reps, const char *caller)
void validatePauliCodes(enum pauliOpType *pauliCodes, int numPauliCodes, const char *caller)
void densmatr_applyDiagonalOp(Qureg qureg, DiagonalOp op)