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

Functions for applying general two-qubit diagonal matrices, as DiagMatr2. More...

Functions

void applyControlledDiagMatr2 (Qureg qureg, int control, int target1, int target2, DiagMatr2 matr)
 
void applyDiagMatr2 (Qureg qureg, int target1, int target2, DiagMatr2 matr)
 
void applyMultiControlledDiagMatr2 (Qureg qureg, int *controls, int numControls, int target1, int target2, DiagMatr2 matr)
 
void applyMultiControlledDiagMatr2 (Qureg qureg, std::vector< int > controls, int target1, int target2, DiagMatr2 matr)
 
void applyMultiStateControlledDiagMatr2 (Qureg qureg, int *controls, int *states, int numControls, int target1, int target2, DiagMatr2 matr)
 
void applyMultiStateControlledDiagMatr2 (Qureg qureg, std::vector< int > controls, std::vector< int > states, int target1, int target2, DiagMatr2 matr)
 
void multiplyDiagMatr2 (Qureg qureg, int target1, int target2, DiagMatr2 matr)
 

Detailed Description

Functions for applying general two-qubit diagonal matrices, as DiagMatr2.

Function Documentation

◆ applyControlledDiagMatr2()

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

Definition at line 307 of file operations.cpp.

307 {
308
309 int targs[] = {target1, target2};
310 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, &control, nullptr, 1, targs, 2, matrix, __func__);
311}

◆ applyDiagMatr2()

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

Definition at line 301 of file operations.cpp.

301 {
302
303 int targs[] = {target1, target2};
304 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, nullptr, nullptr, 0, targs, 2, matrix, __func__);
305}

◆ applyMultiControlledDiagMatr2() [1/2]

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

Definition at line 313 of file operations.cpp.

313 {
314
315 int targs[] = {target1, target2};
316 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, nullptr, numControls, targs, 2, matrix, __func__);
317}

Referenced by applyMultiControlledDiagMatr2().

◆ applyMultiControlledDiagMatr2() [2/2]

void applyMultiControlledDiagMatr2 ( Qureg qureg,
std::vector< int > controls,
int target1,
int target2,
DiagMatr2 matr )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 327 of file operations.cpp.

327 {
328
329 applyMultiControlledDiagMatr2(qureg, controls.data(), controls.size(), target1, target2, matr);
330}
void applyMultiControlledDiagMatr2(Qureg qureg, int *controls, int numControls, int target1, int target2, DiagMatr2 matrix)

◆ applyMultiStateControlledDiagMatr2() [1/2]

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

Definition at line 319 of file operations.cpp.

319 {
320
321 int targs[] = {target1, target2};
322 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, targs, 2, matrix, __func__);
323}

Referenced by applyMultiStateControlledDiagMatr2().

◆ applyMultiStateControlledDiagMatr2() [2/2]

void applyMultiStateControlledDiagMatr2 ( Qureg qureg,
std::vector< int > controls,
std::vector< int > states,
int target1,
int target2,
DiagMatr2 matr )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 332 of file operations.cpp.

332 {
333 validate_controlsMatchStates(controls.size(), states.size(), __func__);
334
335 applyMultiStateControlledDiagMatr2(qureg, controls.data(), states.data(), controls.size(), target1, target2, matr);
336}
void applyMultiStateControlledDiagMatr2(Qureg qureg, int *controls, int *states, int numControls, int target1, int target2, DiagMatr2 matrix)

◆ multiplyDiagMatr2()

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

Definition at line 292 of file operations.cpp.

292 {
293 validate_quregFields(qureg, __func__);
294 validate_twoTargets(qureg, target1, target2, __func__);
295 validate_matrixFields(matrix, __func__); // matrix can be non-unitary
296
297 bool conj = false;
298 localiser_statevec_anyCtrlTwoTargDiagMatr(qureg, {}, {}, target1, target2, matrix, conj);
299}