From: "Ara.T.Howard" Date: 2005-08-05T23:13:21+09:00 Subject: Re: algorithm help On Fri, 5 Aug 2005, Kroeger Simon (ext) wrote: > true, this is optimized for the given case (m <= 2). which was exactly the tast at hand - this is 'always' true for my data. > this creates a BigInt 1250 Bytes width, alocates 10 kByte of memory, fills > it, reverses it, and scans it with a regular expression. All to look at 17 > fixnums, it may be O(C * n) but with a realy huge C. and i'm scanning rows with about 7324 pixels so this matters... > ok, I don't want to invest that much time either, but your code doesn't cope > with negativ numbers :) indeed. and the code (my code) needs to do exactly that - i searching for pixels indicating that the sun is below the horizon using narray like below_horizon = (narray < -3).where and then applying some data munging to only those areas of the scanline. the area will always be zero, one, or two sections for pure daytime, crossing the solar terminator away from the poles, and crossing the terminator at the poles respectively. it seems like that couldn't be so - but latitutes follow curves in the data to you can get two, but not three, ranges in a single scanline. in addition, the dark area, when there are two, will always be on opposite ends of the scanline to the 'divide and conquer' approach is particularly suitable. cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================