The Quantum Exact Simulation Toolkit v4.2.0
Loading...
Searching...
No Matches
FullStateDiagMatr

Functions for applying general all-qubit diagonal matrices, as FullStateDiagMatr. More...

Functions

void applyFullStateDiagMatr (Qureg qureg, FullStateDiagMatr matrix)
 
void applyFullStateDiagMatrPower (Qureg qureg, FullStateDiagMatr matrix, qcomp exponent)
 

Detailed Description

Functions for applying general all-qubit diagonal matrices, as FullStateDiagMatr.

Function Documentation

◆ applyFullStateDiagMatr()

void applyFullStateDiagMatr ( Qureg qureg,
FullStateDiagMatr matrix )
Note
Documentation for this function or struct is under construction!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!

Definition at line 458 of file operations.cpp.

458 {
459 validate_quregFields(qureg, __func__);
460 validate_matrixFields(matrix, __func__);
461 validate_matrixAndQuregAreCompatible(matrix, qureg, false, __func__);
462 validate_matrixIsUnitary(matrix, __func__);
463
464 applyFullStateDiagMatrPower(qureg, matrix, 1); // harmlessly re-validates
465}
void applyFullStateDiagMatrPower(Qureg qureg, FullStateDiagMatr matrix, qcomp exponent)

Referenced by TEST_CASE().

◆ applyFullStateDiagMatrPower()

void applyFullStateDiagMatrPower ( Qureg qureg,
FullStateDiagMatr matrix,
qcomp exponent )
Note
Documentation for this function or struct is under construction!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
See also

Definition at line 467 of file operations.cpp.

467 {
468 validate_quregFields(qureg, __func__);
469 validate_matrixFields(matrix, __func__);
470 validate_matrixAndQuregAreCompatible(matrix, qureg, false, __func__);
471 validate_matrixIsUnitary(matrix, __func__);
472 validate_unitaryExponentIsReal(exponent, __func__);
473 validate_matrixExpIsNonDiverging(matrix, exponent, __func__);
474
475 // rho -> matrix^exponent rho conj(matrix^exponent)
476 bool leftMultiply = true;
477 bool rightMultiply = true;
478 bool rightConj = true;
479
480 (qureg.isDensityMatrix)?
481 localiser_densmatr_allTargDiagMatr(qureg, matrix, exponent, leftMultiply, rightMultiply, rightConj):
482 localiser_statevec_allTargDiagMatr(qureg, matrix, exponent);
483}

Referenced by applyFullStateDiagMatr(), and TEST_CASE().