[SciPy-User] It is quite confusing to use scipy.spatial.distance
江大伟
zw4131 at gmail.com
Mon May 30 13:12:16 EDT 2011
I am sorry that I did not say clearly.I mean:
Extending Scipy.spatial.distance.cdist() to be an uniform function to
Computes the distance between any-dimensional array.
For example:
A=numpy.array([0,0])
B=numpy.array([1,0])
scipy.spatial.distance.cdist(A, B ,'euclidean')
can return a value 1
A=numpy.array([0,0])
B=numpy.array([[1,0],[0,1]])
scipy.spatial.distance.cdist(A, B ,'euclidean')
can return a vector [1,1]
A=numpy.array([[0,0],[0,1]])
B=numpy.array([[1,0],[0,1]])
scipy.spatial.distance.cdist(A, B ,'euclidean')
can return a matrix[[1,1],[1.414,0]]
2011/5/30 Pauli Virtanen <pav at iki.fi>
> Mon, 30 May 2011 20:26:13 +0800, 江大伟 wrote:
> > Thanks. This is an googd solusion.
> > But it is not the best solusion.
> >
> > Using an uniform function to Computes the distance between
> > any-dimensional array. Scipy.spatial.distance.cdist() is a very good
> > function, and it can be extended to Computes the distance between a
> > vector and a vector as well as between a vector and n vectors. That
> > would be perfect !!.
>
> I do not understand what you exactly mean. The example I gave does
> exactly what you describe.
>
> --
> Pauli Virtanen
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110531/de0acb6e/attachment.html>
More information about the SciPy-User
mailing list