Is there a way to implement this function that is part of QuTip functions ( Quantum Toolbox in Python) without the need for installing QuTip?
def destroy(N, offset=0):
if not isinstance(N, (int, np.integer)): # raise error if N not integer
raise ValueError("Hilbert space dimension must be integer value")
data = np.sqrt(np.arange(offset+1, N+offset, dtype=complex))
ind = np.arange(1,N, dtype=np.int32)
ptr = np.arange(N+1, dtype=np.int32)
ptr[-1] = N-1
return Qobj(fast_csr_matrix((data,ind,ptr),shape=(N,N)), isherm=False)
DESTROY returns annihilation operator for N-dimensional Hilbert space out = destroy(N), N is integer value & N>0