| 3028 | } |
| 3029 | |
| 3030 | bool QPilotMachine::build_noise_params(const uint32_t& nose_model_type, |
| 3031 | const std::vector<double>& single_params, |
| 3032 | const std::vector<double>& double_params, |
| 3033 | PilotNoiseParams& noise_params) |
| 3034 | { |
| 3035 | auto _found_iter = noise_model_mapping.find((NOISE_MODEL)nose_model_type); |
| 3036 | if (noise_model_mapping.end() == _found_iter |
| 3037 | || single_params.empty() |
| 3038 | || double_params.empty()) |
| 3039 | { |
| 3040 | return false; |
| 3041 | } |
| 3042 | |
| 3043 | if (((NOISE_MODEL::DECOHERENCE_KRAUS_OPERATOR == (NOISE_MODEL)nose_model_type) |
| 3044 | && ((single_params.size() != 3) || (double_params.size() != 3))) |
| 3045 | || |
| 3046 | ((NOISE_MODEL::DECOHERENCE_KRAUS_OPERATOR != (NOISE_MODEL)nose_model_type) |
| 3047 | && (single_params.size() != 1 || double_params.size() != 1))) |
| 3048 | { |
| 3049 | return false; |
| 3050 | } |
| 3051 | |
| 3052 | noise_params.noise_model = _found_iter->second; |
| 3053 | noise_params.single_gate_param = single_params[0]; |
| 3054 | noise_params.double_gate_param = double_params[0]; |
| 3055 | |
| 3056 | if (NOISE_MODEL::DECOHERENCE_KRAUS_OPERATOR == (NOISE_MODEL)nose_model_type) |
| 3057 | { |
| 3058 | noise_params.single_p2 = single_params[1]; |
| 3059 | noise_params.double_p2 = double_params[1]; |
| 3060 | noise_params.single_pgate = single_params[2]; |
| 3061 | noise_params.double_pgate = double_params[2]; |
| 3062 | } |
| 3063 | |
| 3064 | return true; |
| 3065 | } |
| 3066 | |
| 3067 | ErrorCode QPilotMachine::execute_noise_measure_task(const std::string& prog_str, |
| 3068 | const PilotNoiseParams& noise_params, |
no test coverage detected