[SciPy-dev] ticket 464

Matthieu Brucher matthieu.brucher at gmail.com
Thu Jul 26 10:56:30 EDT 2007


Instead of flatten(), you can use ravel() which does not copy the data if it
is not needed (perhaps squeeze() is a good candidate too ?)

Matthieu

2007/7/26, dmitrey <openopt at ukr.net>:
>
> also, I think rank is better to be replaced by x.ndim
> Am I right?
> Regards, D.
>
>
> dmitrey wrote:
> > 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.
> >
> > _______________________________________________
> > Scipy-dev mailing list
> > Scipy-dev at scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-dev
> >
> >
> >
> >
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20070726/f9a30d67/attachment.html>


More information about the SciPy-Dev mailing list