10
10
// copyright notice, and modified files need to carry a notice indicating
11
11
// that they have been altered from the originals.
12
12
13
- // #[cfg(feature = "cache_pygates")]
13
+ #[ cfg( feature = "cache_pygates" ) ]
14
14
use std:: cell:: OnceCell ;
15
15
use std:: f64:: consts:: PI ;
16
16
use std:: hash:: Hash ;
@@ -60,7 +60,7 @@ enum DecomposerType {
60
60
61
61
#[ derive( Clone , Debug ) ]
62
62
enum UnitarySynthesisReturnType {
63
- DAGType ( DAGCircuit ) ,
63
+ DAGType ( Box < DAGCircuit > ) ,
64
64
TwoQSequenceType ( TwoQubitUnitarySequence ) ,
65
65
}
66
66
@@ -185,7 +185,7 @@ fn dag_from_2q_gate_sequence(
185
185
clbits : target_dag. cargs_interner . get_default ( ) ,
186
186
params : new_params,
187
187
extra_attrs : None ,
188
- // #[cfg(feature = "cache_pygates")]
188
+ #[ cfg( feature = "cache_pygates" ) ]
189
189
py_op : OnceCell :: new ( ) ,
190
190
} ;
191
191
instructions. push ( pi) ;
@@ -423,7 +423,7 @@ fn py_run_default_main_loop(
423
423
UnitarySynthesisReturnType :: DAGType ( synth_dag) => synth_dag,
424
424
UnitarySynthesisReturnType :: TwoQSequenceType (
425
425
synth_sequence,
426
- ) => dag_from_2q_gate_sequence ( py, synth_sequence) ?,
426
+ ) => Box :: new ( dag_from_2q_gate_sequence ( py, synth_sequence) ?) ,
427
427
} ;
428
428
429
429
let _ = out_dag. set_global_phase ( add_global_phase (
@@ -1060,7 +1060,7 @@ fn synth_su4(
1060
1060
} ;
1061
1061
1062
1062
match preferred_direction {
1063
- None => Ok ( UnitarySynthesisReturnType :: DAGType ( synth_dag) ) ,
1063
+ None => Ok ( UnitarySynthesisReturnType :: DAGType ( Box :: new ( synth_dag) ) ) ,
1064
1064
Some ( preferred_dir) => {
1065
1065
let mut synth_direction: Option < Vec < u32 > > = None ;
1066
1066
for node in synth_dag. topological_op_nodes ( ) ? {
@@ -1074,7 +1074,7 @@ fn synth_su4(
1074
1074
}
1075
1075
// synth direction is in the relative basis
1076
1076
match synth_direction {
1077
- None => Ok ( UnitarySynthesisReturnType :: DAGType ( synth_dag) ) ,
1077
+ None => Ok ( UnitarySynthesisReturnType :: DAGType ( Box :: new ( synth_dag) ) ) ,
1078
1078
Some ( synth_direction) => {
1079
1079
let synth_dir = match synth_direction. as_slice ( ) {
1080
1080
[ 0 , 1 ] => true ,
@@ -1090,7 +1090,7 @@ fn synth_su4(
1090
1090
decomposer_gate_params,
1091
1091
)
1092
1092
} else {
1093
- Ok ( UnitarySynthesisReturnType :: DAGType ( synth_dag) )
1093
+ Ok ( UnitarySynthesisReturnType :: DAGType ( Box :: new ( synth_dag) ) )
1094
1094
}
1095
1095
}
1096
1096
}
@@ -1227,7 +1227,7 @@ fn reversed_synth_su4(
1227
1227
let _ = target_dag. push_back ( py, inst. clone ( ) ) ;
1228
1228
}
1229
1229
}
1230
- Ok ( UnitarySynthesisReturnType :: DAGType ( target_dag) )
1230
+ Ok ( UnitarySynthesisReturnType :: DAGType ( Box :: new ( target_dag) ) )
1231
1231
}
1232
1232
1233
1233
#[ pymodule]
0 commit comments