Displaying 1 result from an estimated 1 matches for "delta_km".
Did you mean:
  delta_itm
  
2012 Apr 08
0
multithreaded low level functions
...X),length(vecY)))
  #print(sprintf("Len delta_lon: %d", length(delta_lon)))
  R = 6372.8 #Radius of the earth (km)
  #spherical law of cosines:
  #acos(sin(lat)*sin(lat) + cos(lat)*cos(lat)*cos(delta lon))
  delta_rad = acos(sin(pointY)*sin(vecY) +
cos(pointY)*cos(vecY)*cos(delta_lon))
  delta_km = R*delta_rad
  return(delta_km)
}
vecX and vecY are very large, about 500k elements or more. I want to know
the most efficient way to write this function. I don't even need to do
lapply or an apply function for this because I assume that cos(vector) and
sign(vector) will handle all of the mul...