hello,

I am trying to calculate the results of a function between two matrices:

>>> F.shape
(170, 2)
>>> T.shape
(170, 481, 2)

Where F contains lat/lon pairs and T contains 481 lat/lon pairs for 170
trajectories of length 481

I want a new array of shape
(170,481)

containing the results of my distance function:

gcd(x1,y1,x2,y3):
   """ returns great circle distance"""
   ...
   return dist


Is there a way to do this without the use of loops?

I'm thinking something along the lines of:

distances = [[gcd(f[0],f[1],t[0],t[1]]) for f in F] for t in T]

But obviously this doesn't work...

Thank you,
john
-- 
View this message in context: 
http://www.nabble.com/efficient-function-calculation-between-two-matrices-tp22054148p22054148.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to