| 2889 | } |
| 2890 | |
| 2891 | void assertKrausMapValidNumMatrices(int numQubits, int numMatrices, const char* caller) { |
| 2892 | |
| 2893 | assertThat( |
| 2894 | numMatrices >= 1, report::KRAUS_MAP_NUM_GIVEN_NEW_MATRICES_NOT_POSITIVE, {{"${NUM_MATRICES}", numMatrices}}, caller); |
| 2895 | |
| 2896 | // this won't overflow given huge 'numQubits', because we prior validate the implied superoperator |
| 2897 | qindex maxNumBeforeIndOverflow = mem_getMaxNumKrausMapMatricesBeforeIndexOverflow(numQubits); |
| 2898 | |
| 2899 | assertThat( |
| 2900 | numMatrices <= maxNumBeforeIndOverflow, report::KRAUS_MAP_MATRICES_TOTAL_ELEMS_WOULD_EXCEED_QINDEX, |
| 2901 | {{"${NUM_MATRICES}", numMatrices}, {"${NUM_QUBITS}", numQubits}, {"${MAX_NUM_MATRICES}", maxNumBeforeIndOverflow}}, caller); |
| 2902 | |
| 2903 | qindex maxNumBeforeMemOverflow = mem_getMaxNumKrausMapMatricesBeforeLocalMemSizeofOverflow(numQubits); |
| 2904 | assertThat( |
| 2905 | numMatrices <= maxNumBeforeMemOverflow, report::KRAUS_MAP_MATRICES_TOTAL_MEM_WOULD_EXCEED_SIZEOF, |
| 2906 | {{"${NUM_MATRICES}", numMatrices}, {"${NUM_QUBITS}", numQubits}, {"${MAX_NUM_MATRICES}", maxNumBeforeMemOverflow}}, caller); |
| 2907 | } |
| 2908 | |
| 2909 | void validate_newKrausMapParams(int numQubits, int numMatrices, const char* caller) { |
| 2910 |
no test coverage detected