Closed
Description
Issue Description
Hi, I'm trying to apply a gate with the qubit index specified by an integer i from jax.numpy array. But I get ValueError: Illegal index specification. I think it's because isinstance(i, int) returns False.
I want to do this because I need to jit, and forcing type conversion using int(i) will make it unjittable.
How to Reproduce
import jax.numpy as jnp
import tensorcircuit as tc
c = tc.Circuit(1)
ind = jnp.array([0], dtype=int)
c.X(ind[0])
Error Output
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[139], line 3
1 c = tc.Circuit(1)
2 ind = jnp.array([0], dtype=int)
----> 3 c.X(ind[0])
File [~/miniconda3/lib/python3.10/site-packages/tensorcircuit/abstractcircuit.py:196](~/miniconda3/lib/python3.10/site-packages/tensorcircuit/abstractcircuit.py:196), in AbstractCircuit.apply_general_gate_delayed..apply_list(self, *index, **kws)
194 apply(self, *ind, **kws)
195 else:
--> 196 raise ValueError("Illegal index specification")
ValueError: Illegal index specification
Environment Context
OS info: macOS-10.16-x86_64-i386-64bit
Python version: 3.10.10
Numpy version: 1.24.4
Scipy version: 1.11.0
Pandas version: 2.0.3
TensorNetwork version: 0.4.6
Cotengra is not installed
TensorFlow is not installed
Jax version: 0.4.13
Jax installation doesn't support GPU
JaxLib version: 0.4.13
PyTorch is not installed
Cupy is not installed
Qiskit version: 0.25.0
Cirq version: 1.2.0
TensorCircuit version 0.10.0