I have been working on some code that does integration, some manipulation, and then more integration.
Here is the code (thanks @JRichardSnape!).
Basically this code solves a matrix equation, which is what mesolve
does. It takes in a Hamiltonian (a key physical matrix), an initial density matrix, rho0
, and a tlist of times to evaluate rho(t) at (what we are solving for) and the collapse operators, L1, L2, L3, L4, L5, L6, L7
. Then I extract the results and multiply by two other arrays and plot it.
I use the qutip quantum mechanics module since they have the solver I need: mesolve
. The qutip module requires all matrices to be converted into a quantum object, which is done by Qobj(x).
I have added a line defining rho0=L1 right after the collapse operators definition. When this happens, it gives me an Index error:
IndexError: index 0 is out of bounds for axis 0 with size 0
I have tried to find out what is wrong. It goes wrong during the definition of f_t. The problem is when it is trying to index the array (n.data is a single element array of a complex128 number). What is going on?
This reproduces your error:
Without delving to the the linked code, it is clear that the array in question has a 0 length 1st dimension.
x.shape[0]
is 0.You might get such an array be indexing another with an empty list,
With the limited information you give it's hard to be more specific. Check the shape of all the suspected arrays.
So
Qobj
is documented in http://qutip.org/docs/2.2.0/apidoc/classes.htmland
mesolve
in http://qutip.org/docs/2.2.0/apidoc/functions.html#qutip.mesolve.mesolveand
rho0
is expected to berho0 : qutip.qobj
.The underlying array for
ground
is a(7,1)
shape, forL1
(the problemrho0
?) is(7,7)
and all 0's except for [0,0].Looks like this is a spin off of Integration not successful in Python QuTiP