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

Functions for applying general two-qubit dense matrices, as CompMatr2. More...

Functions

void applyCompMatr2 (Qureg qureg, int target1, int target2, CompMatr2 matrix)
 
void applyControlledCompMatr2 (Qureg qureg, int control, int target1, int target2, CompMatr2 matr)
 
void applyMultiControlledCompMatr2 (Qureg qureg, int *controls, int numControls, int target1, int target2, CompMatr2 matr)
 
void applyMultiStateControlledCompMatr2 (Qureg qureg, int *controls, int *states, int numControls, int target1, int target2, CompMatr2 matr)
 
void multiplyCompMatr2 (Qureg qureg, int target1, int target2, CompMatr2 matr)
 

Detailed Description

Functions for applying general two-qubit dense matrices, as CompMatr2.

Function Documentation

◆ applyCompMatr2()

void applyCompMatr2 ( Qureg qureg,
int target1,
int target2,
CompMatr2 matrix )
Note
Documentation for this function or struct is under construction!

Applies a general two-qubit dense unitary matrix to qubits target1 and target2 (treated as increasing significance) of qureg.

Diagram
See also

Definition at line 131 of file operations.cpp.

131 {
132
133 int targs[] = {target1, target2};
134 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, nullptr, nullptr, 0, targs, 2, matrix, __func__);
135}

◆ applyControlledCompMatr2()

void applyControlledCompMatr2 ( Qureg qureg,
int control,
int target1,
int target2,
CompMatr2 matr )
Note
Documentation for this function or struct is under construction!

Applies a singly-controlled two-qubit dense unitary matrix to qubits target1 and target2 (treated as increasing significance) of qureg.

Diagram
See also

Definition at line 137 of file operations.cpp.

137 {
138
139 int targs[] = {target1, target2};
140 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, &control, nullptr, 1, targs, 2, matrix, __func__);
141}

◆ applyMultiControlledCompMatr2()

void applyMultiControlledCompMatr2 ( Qureg qureg,
int * controls,
int numControls,
int target1,
int target2,
CompMatr2 matr )
Note
Documentation for this function or struct is under construction!

Applies a multiply-controlled two-qubit dense unitary matrix to qubits target1 and target2 (treated as increasing significance) of qureg.

Diagram
See also

Definition at line 143 of file operations.cpp.

143 {
144
145 int targs[] = {target1, target2};
146 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, nullptr, numControls, targs, 2, matrix, __func__);
147}

Referenced by applyMultiControlledCompMatr2().

◆ applyMultiStateControlledCompMatr2()

void applyMultiStateControlledCompMatr2 ( Qureg qureg,
int * controls,
int * states,
int numControls,
int target1,
int target2,
CompMatr2 matr )
Note
Documentation for this function or struct is under construction!

Applies an arbitrarily-controlled two-qubit dense unitary matrix to qubits target1 and target2 (treated as increasing significance) of qureg, conditioned upon the controls being in the given states.

Diagram
See also

Definition at line 149 of file operations.cpp.

149 {
150
151 int targs[] = {target1, target2};
152 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, targs, 2, matrix, __func__);
153}

Referenced by applyMultiStateControlledCompMatr2(), and applyMultiStateControlledSqrtSwap().

◆ multiplyCompMatr2()

void multiplyCompMatr2 ( Qureg qureg,
int target1,
int target2,
CompMatr2 matr )
Note
Documentation for this function or struct is under construction!
See also

Definition at line 121 of file operations.cpp.

121 {
122 validate_quregFields(qureg, __func__);
123 validate_twoTargets(qureg, target1, target2, __func__);
124 validate_matrixFields(matrix, __func__); // matrix can be non-unitary
125 validate_mixedAmpsFitInNode(qureg, 2, __func__);
126
127 bool conj = false;
128 localiser_statevec_anyCtrlTwoTargDenseMatr(qureg, {}, {}, target1, target2, matrix, conj);
129}