The Quantum Exact Simulation Toolkit v4.1.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 132 of file operations.cpp.

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

◆ 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 138 of file operations.cpp.

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

◆ 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 144 of file operations.cpp.

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

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 150 of file operations.cpp.

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

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 122 of file operations.cpp.

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