@@ -351,7 +351,7 @@ struct MappingTraits<cudaq::qec::decoding::config::decoder_config> {
351351 io.mapRequired (" syndrome_size" , config.syndrome_size );
352352 io.mapRequired (" H_sparse" , config.H_sparse );
353353 io.mapRequired (" O_sparse" , config.O_sparse );
354- io.mapOptional (" D_sparse" , config.D_sparse );
354+ io.mapRequired (" D_sparse" , config.D_sparse );
355355
356356 // Validate that the number of rows in the H_sparse vector is equal to
357357 // syndrome_size.
@@ -383,9 +383,9 @@ struct MappingTraits<cudaq::qec::decoding::config::decoder_config> {
383383 // Validate that if the D_sparse is provided, it is a valid D matrix. That
384384 // means that the number of rows in the D_sparse matrix should be equal to
385385 // the number of rows in the H_sparse matrix, and no row should be empty.
386- if (config.D_sparse .has_value ()) {
386+ if (! config.D_sparse .empty ()) {
387387 auto num_D_rows =
388- std::count (config.D_sparse -> begin (), config.D_sparse -> end (), -1 );
388+ std::count (config.D_sparse . begin (), config.D_sparse . end (), -1 );
389389 if (num_D_rows != config.syndrome_size ) {
390390 throw std::runtime_error (" Number of rows in D_sparse vector is not "
391391 " equal to syndrome_size: " +
@@ -394,14 +394,13 @@ struct MappingTraits<cudaq::qec::decoding::config::decoder_config> {
394394 }
395395 // No row should be empty, which means that there should be no
396396 // back-to-back -1 values.
397- for (std::size_t i = 0 ; i < config.D_sparse -> size () - 1 ; ++i) {
398- if (config.D_sparse -> at (i) == -1 && config.D_sparse -> at (i + 1 ) == -1 ) {
397+ for (std::size_t i = 0 ; i < config.D_sparse . size () - 1 ; ++i) {
398+ if (config.D_sparse . at (i) == -1 && config.D_sparse . at (i + 1 ) == -1 ) {
399399 throw std::runtime_error (" D_sparse row is empty for decoder " +
400400 std::to_string (config.id ));
401401 }
402402 }
403403 }
404-
405404#define INIT_AND_MAP_DECODER_CUSTOM_ARGS (type ) \
406405 do { \
407406 if (!std::holds_alternative<type>(config.decoder_custom_args )) { \
0 commit comments