Why does my 'instance' turn into an 'ndarray' when I use Scipy optimize?
I have written a function using a quantum simulation class [QuTIP][1] that returns a float. Next, I called scipy.optimize.fmin_cg on the function. I keep getting the error:

    AttributeError: 'numpy.ndarray' object has no attribute 'expm'

on the line:

    U_sq = H_sq.expm

But H_sq is an instance of Qobj, not an ndarray. If I run the function outside of scipy.optimize.fmin_cg, it returns the type as 'instance'; when it runs inside of fmin_cg it returns the type as 'ndarray'. 

Why does it do this? Is there a optimization function in python that will respect using instances like this?


  [1]: http://qutip.googlecode.com
Why does my 'instance' turn into an 'ndarray' when I use Scipy optimize?
===

I have written a function using a quantum simulation class [QuTIP][1] that returns a float. Next, I called scipy.optimize.fmin_cg on the function. I keep getting the error:

    AttributeError: 'numpy.ndarray' object has no attribute 'expm'

on the line:

    U_sq = H_sq.expm

But H_sq is an instance of Qobj, not an ndarray. If I run the function outside of scipy.optimize.fmin_cg, it returns the type as 'instance'; when it runs inside of fmin_cg it returns the type as 'ndarray'. 

Why does it do this? Is there a optimization function in python that will respect using instances like this?


  [1]: http://qutip.googlecode.com