Best way to compute length of arbitrary dimension vector?
Gabriel
snoopy.67.z at googlemail.com
Fri Jun 3 17:53:18 EDT 2011
More information about the Python-list mailing list
Fri Jun 3 17:53:18 EDT 2011
- Previous message (by thread): Best way to compute length of arbitrary dimension vector?
- Next message (by thread): Best way to compute length of arbitrary dimension vector?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> The dimension is arbitrary, though, so: > > length = reduce(math.hypot, self._coords, 0) > Thanks, I was going to ask Algis that same question. But still, is this solution really faster or better than the one using list comprehension and the expression 'x*x'? It seems to me that the above solution (using hypot) involves repeated square roots (with subsequent squaring). Best regards, Gabriel.
- Previous message (by thread): Best way to compute length of arbitrary dimension vector?
- Next message (by thread): Best way to compute length of arbitrary dimension vector?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list