@@ -71,10 +71,11 @@ class IonQServerHelper : public ServerHelper {
7171 std::string &jobId) override ;
7272
7373 // / @brief extract the job shots url from jobs returned by Ion API
74- std::string getShotsUrl (nlohmann::json_v3_11_1::json &jobs,
74+ std::string getShotsUrl (nlohmann::json_v3_11_1::json &jobs,
7575 const char *DEFAULT_URL);
7676
77- // / @brief Verify if shot-wise output was requested by user and can be extracted
77+ // / @brief Verify if shot-wise output was requested by user and can be
78+ // / extracted
7879 bool shotWiseOutputIsNeeded (nlohmann::json_v3_11_1::json &jobs);
7980
8081private:
@@ -364,26 +365,26 @@ bool IonQServerHelper::jobIsDone(ServerMessage &getJobResponse) {
364365 return jobs[0 ].at (" status" ).get <std::string>() == " completed" ;
365366}
366367
367- std::string IonQServerHelper::getShotsUrl (nlohmann::json_v3_11_1::json &jobs,
368+ std::string IonQServerHelper::getShotsUrl (nlohmann::json_v3_11_1::json &jobs,
368369 const char *DEFAULT_URL) {
369370 if (!keyExists (" url" ))
370371 throw std::runtime_error (" Key 'url' doesn't exist in backendConfig." );
371372
372373 std::string base_url = backendConfig.at (" url" );
373374 std::string shotsUrl = " " ;
374375
375- if (!jobs.empty () &&
376- jobs[0 ].contains (" results" ) &&
376+ if (!jobs.empty () && jobs[0 ].contains (" results" ) &&
377377 jobs[0 ].at (" results" ).contains (" shots" ) &&
378378 jobs[0 ].at (" results" ).at (" shots" ).contains (" url" )) {
379- shotsUrl = base_url +
380- jobs[0 ].at (" results" ).at (" shots" ).at (" url" ).get <std::string>();
379+ shotsUrl = base_url +
380+ jobs[0 ].at (" results" ).at (" shots" ).at (" url" ).get <std::string>();
381381 }
382382
383383 return shotsUrl;
384384}
385385
386- bool IonQServerHelper::shotWiseOutputIsNeeded (nlohmann::json_v3_11_1::json &jobs) {
386+ bool IonQServerHelper::shotWiseOutputIsNeeded (
387+ nlohmann::json_v3_11_1::json &jobs) {
387388 std::string noiseModel = " ideal" ;
388389 if (!jobs.empty () && jobs[0 ].contains (" noise" ) &&
389390 jobs[0 ][" noise" ].contains (" model" )) {
@@ -394,12 +395,13 @@ bool IonQServerHelper::shotWiseOutputIsNeeded(nlohmann::json_v3_11_1::json &jobs
394395
395396 std::string target = " simulator" ;
396397 if (!jobs.empty () && jobs[0 ].contains (" target" )) {
397- target = jobs[0 ][" target" ].get <std::string>();
398+ target = jobs[0 ][" target" ].get <std::string>();
398399 } else if (keyExists (" target" )) {
399400 target = backendConfig[" target" ];
400401 }
401402
402- bool targetHasMemoryOption = keyExists (" memory" ) && backendConfig[" memory" ] == " true" ;
403+ bool targetHasMemoryOption =
404+ keyExists (" memory" ) && backendConfig[" memory" ] == " true" ;
403405 bool targetHasNoiseModel = noiseModel != " ideal" ;
404406 bool targetIsNotSimulator = target != " simulator" ;
405407
@@ -516,16 +518,17 @@ IonQServerHelper::processResults(ServerMessage &postJobResponse,
516518 int64_t s = std::stoull (element.value ().get <std::string>());
517519 std::string bitString = std::bitset<64 >(s).to_string ();
518520 auto firstone = bitString.find_first_not_of (' 0' );
519- bitString = (firstone == std::string::npos) ? " 0" : bitString.substr (firstone);
521+ bitString =
522+ (firstone == std::string::npos) ? " 0" : bitString.substr (firstone);
520523 if (bitString.size () < static_cast <size_t >(nQubits)) {
521- bitString.insert (bitString.begin (),
522- static_cast <size_t >(nQubits) - bitString.size (), ' 0' );
523- }
524+ bitString.insert (bitString.begin (),
525+ static_cast <size_t >(nQubits) - bitString.size (), ' 0' );
526+ }
524527 bitStrings.push_back (bitString);
525528 }
526529
527530 if (!execResults.empty ())
528- execResults[0 ].sequentialData = std::move (bitStrings);
531+ execResults[0 ].sequentialData = std::move (bitStrings);
529532 }
530533
531534 // Return a sample result including the global register and all individual
@@ -554,4 +557,4 @@ RestHeaders IonQServerHelper::getHeaders() {
554557} // namespace cudaq
555558
556559// Register the IonQ server helper in the CUDA-Q server helper factory
557- CUDAQ_REGISTER_TYPE (cudaq::ServerHelper, cudaq::IonQServerHelper, ionq)
560+ CUDAQ_REGISTER_TYPE (cudaq::ServerHelper, cudaq::IonQServerHelper, ionq)
0 commit comments