bosonic icon indicating copy to clipboard operation
bosonic copied to clipboard

fock.basis_size gives overflow error

Open rdprins opened this issue 4 years ago • 0 comments

Example: print(len(bosonic.fock.basis(11,4))) gives correct result print(bosonic.fock.basis_size(11,4)) gives the following error:

File "bosonic\fock.pyx", line 109, in bosonic.fock.basis_size OverflowError: Python int too large to convert to C long

Possible solution: I forked the code, (converted to python 3) and changed bosonic.fock.basis_size to:

def basis_size(int n, int m):
    cdef int res = scipy.special.binom(n+m-1,n)
    return res

A more efficient solution should be possible.

rdprins avatar Mar 08 '21 20:03 rdprins