MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / assertMatrixIsUnitary

Function assertMatrixIsUnitary

quest/src/core/validation.cpp:2419–2434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2417// type T can be CompMatr1, CompMatr2, CompMatr, DiagMatr1, DiagMatr2, DiagMatr, FullStateDiagMatr
2418template <class T>
2419void assertMatrixIsUnitary(T matr, const char* caller) {
2420
2421 // validate both stack and heap matrices have been correctly initialised
2422 validate_matrixFields(matr, caller);
2423
2424 // validate heap matrices have ever written to their GPU memories (if exists)
2425 if constexpr (util_isHeapMatrixType<T>())
2426 validate_matrixIsSynced(matr, caller);
2427
2428 // avoid superfluous expensive unitarity check below (do not overwrite .isApproxUnitary)
2429 if (isNumericalValidationDisabled())
2430 return;
2431
2432 // may overwrite matr.isApproxUnitary of heap matrices, otherwise ignores epsilon
2433 assertThat(util_isUnitary(matr, global_validationEpsilon), report::MATRIX_NOT_UNITARY, caller);
2434}
2435void validate_matrixIsUnitary(CompMatr1 m, const char* caller) { assertMatrixIsUnitary(m, caller); }
2436void validate_matrixIsUnitary(CompMatr2 m, const char* caller) { assertMatrixIsUnitary(m, caller); }
2437void validate_matrixIsUnitary(CompMatr m, const char* caller) { assertMatrixIsUnitary(m, caller); }

Callers 1

validate_matrixIsUnitaryFunction · 0.85

Calls 5

validate_matrixFieldsFunction · 0.85
validate_matrixIsSyncedFunction · 0.85
assertThatFunction · 0.85
util_isUnitaryFunction · 0.85

Tested by

no test coverage detected