[SciPy-dev] ticket 464

dmitrey openopt at ukr.net
Thu Jul 26 10:51:17 EDT 2007


hi all,
Nils proposed me to fix the ticket 464
http://projects.scipy.org/scipy/scipy/ticket/464

I found the problem is here:

    rank = len(x0.shape)# So matrix(0.3) yields shape (1,1) here => rank = 2
    if not -1 < rank < 2:
        raise ValueError, "Initial guess must be a scalar or rank-1 
sequence."

I propose to fix it in the way:

    rank = len(x.shape)
    if not -1 < rank < 2:
        if x.shape == (1,1): x = x.flatten()#matrix(0.3) for example
        else: raise ValueError, "Initial guess must be a scalar or 
rank-1 sequence."

If you don't mind (no other opinions during several hours) I will commit 
the change to svn.
I found the same change should be done for optimize.fmin
Regards, D.




More information about the SciPy-Dev mailing list