MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / build_noise_params

Method build_noise_params

Extensions/PilotOSMachine/QPilotMachine.cpp:3030–3065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3028}
3029
3030bool 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
3067ErrorCode QPilotMachine::execute_noise_measure_task(const std::string& prog_str,
3068 const PilotNoiseParams& noise_params,

Callers 3

runWithConfigurationMethod · 0.80
set_noise_modelMethod · 0.80
export_extension_classFunction · 0.80

Calls 4

findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected