adamisntdead/QuSimPy

TypeError: only integer scalar arrays can be converted to a scalar index

danielegrattarola opened this issue · 3 comments

Hi,

i'm trying to run example.py to play with your code but it crashes with the following stack trace:

$ python examples.py 
One Qubit: 0
Five Qubits: 00000
One Qubit (Correct Notation): |0>
Five Qubits (Correct Notation): |00000>
Traceback (most recent call last):
  File "examples.py", line 45, in <module>
    print('NOT Gate: |' + NOT.measure() + '>')
  File ".../QuSimPy/QuSim.py", line 147, in measure
    self.numQubits
  File "/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.py", line 2039, in binary_repr
    binary = bin(num)[2:]
TypeError: only integer scalar arrays can be converted to a scalar index

Is this a problem on my end?
I'm using Numpy 1.14.2, with either Python 2.7.12 or Python 3.5.2.

Thanks,
Daniele

I am on Python 2.7, and Numpy 1.8.0rc1

I will fix this later, sorry about that!

Thanks!! :)
I tried with the same Numpy version that you're using and it does work, indeed. There must have been some changes between versions.

Amazing work btw, so helpful as a QC beginner.

Fixed in the latest commit!