@@ -36,7 +36,6 @@ def generate_2d_circuit(c, lx, ly, params, nqubits, nlayers):
3636
3737def generate_noisy_circuit (c , status , type = "depolarizing" ):
3838 noise_conf = noisemodel .NoiseConf ()
39- # print(type)
4039 if type == "depolarizing" :
4140 error1 = channels .depolarizingchannel (0.1 , 0.1 , 0.1 ) # px, py, pz probabilities
4241 elif type == "amplitudedamping" :
@@ -78,6 +77,7 @@ def benchmark_mega_function(
7877 use_grad = False , # True, False
7978 use_vmap = False , # True, False
8079 contractor = None , # contractor setting like "cotengra-16-128"
80+ jit_compile = True , # True, False
8181):
8282 """
8383 Mega benchmark function that can control all parameters via arguments.
@@ -88,12 +88,13 @@ def benchmark_mega_function(
8888 lx: Lattice size x (for 2D)
8989 ly: Lattice size y (for 2D)
9090 circuit_type: Type of circuit ("circuit", "dmcircuit", "mpscircuit")
91+ bond_dim: Bond dimension for MPS circuits
9192 layout_type: Circuit layout ("1d", "2d")
9293 operation: Operation to perform ("state", "sample", "exps")
9394 noisy: Whether to add noise (only for "circuit" and "dmcircuit")
95+ noisy_type: Type of noise channel ("depolarizing", "amplitudedamping")
9496 use_grad: Whether to compute gradient (AD)
9597 use_vmap: Whether to use vectorized operations
96- batch_size: Batch size for vmap operations
9798 contractor: Contractor setting like "cotengra-16-128"
9899
99100 Returns:
@@ -136,17 +137,17 @@ def circuit_func(params):
136137 # Handle gradient computation
137138 if use_grad and not use_vmap :
138139 grad_func = tc .backend .grad (circuit_func )
139- return tc .backend .jit (grad_func , jit_compile = True )
140+ return tc .backend .jit (grad_func , jit_compile = jit_compile )
140141
141142 # Handle vmap computation
142143 if use_vmap and not use_grad :
143- return tc .backend .jit (tc .backend .vmap (circuit_func ), jit_compile = True )
144+ return tc .backend .jit (tc .backend .vmap (circuit_func ), jit_compile = jit_compile )
144145
145146 # Handle both grad and vmap
146147 if use_grad and use_vmap :
147148 vvag_func = tc .backend .vvag (circuit_func )
148- return tc .backend .jit (vvag_func , jit_compile = True )
149+ return tc .backend .jit (vvag_func , jit_compile = jit_compile )
149150
150151 # Regular operation (no grad, no vmap)
151152 # Always JIT the returned function
152- return tc .backend .jit (circuit_func , jit_compile = True )
153+ return tc .backend .jit (circuit_func , jit_compile = jit_compile )
0 commit comments